The ID Verification iOS SDK enables eKYC remote identity verification in your mobile application. After obtaining a transaction ID from your server, pass it to the SDK to start the verification flow.
Limitations
Requires an iPhone or iPad with iOS 9 or later.
Requires camera and network permissions.
Download and configure the SDK
Get the SDK
Download the iOS SDK from the Client SDK release notes. Extract the package and copy all frameworks into your project folder. You can also download the iOS Demo to try out the features.
Add required permissions
Add the following permissions to your Info.plist file. The permission descriptions are for reference only.

Add xcframeworks in Xcode
Go to Build Settings > Build Phases > Link Binary With Libraries and add the xcframeworks.
Add all the xcframeworks included in the SDK:
AliyunIdentityFace.xcframework AliyunIdentityPlatform.xcframework AliyunIdentityUtils.xcframework AliyunIdentityOcr.xcframework AliyunIdentityNetwork.xcframework AliyunIdentityAdapter.xcframework AliyunCrashKit.xcframework AliyunOSSiOS.xcframework faceguard.xcframework IDVMNN.xcframeworkAdd the following system libraries:
AudioToolbox.framework CoreMedia.framework CoreML.framework AVFoundation.framework SystemConfiguration.framework UIKit.framework CoreTelephony.framework CoreMotion.framework Accelerate.framework libresolv.tbd libsqlite3.tbd libc++.tbd libz.tbd
Copy resource files
Go to Build Settings > Build Phases > Copy Bundle Resources and add the resource files.
AliyunIdentityPlatform.bundle: Find this resource in
AliyunIdentityPlatform.xcframework/ios-arm64/AliyunIdentityPlatform.framework.AliyunIdentityFace.bundle: Find this resource in
AliyunIdentityFace.xcframework/ios-arm64/AliyunIdentityFace.framework.AliyunIdentityOCR.bundle: Find this resource in
AliyunIdentityOcr.xcframework/ios-arm64/AliyunIdentityOcr.framework.
Configure linker flags
Go to Build Settings > Other Linker Flags and add the -ObjC flag.
Call the SDK
Import the header file
#import <AliyunIdentityPlatform/AliyunIdentityPlatform.h>Initialize the SDK
- (void)install;
- (void)installWithOptions:(NSMutableDictionary *)options;Parameters:
options: Optional parameters for data collection. Defaults to null. It accepts the following parameters:
The ID Verification client includes a built-in device helper security module. To comply with data collection requirements across different regions, the client supports multiple data reporting sites. You can use the
CustomUrlandCustomHostparameters to specify a reporting site based on user attributes.You can specify only one data reporting region per application session lifecycle. This region must match the one used for your server-side queries. Server-side region support varies by product. For details, see Supported regions.
Regional
CustomUrlvalues:China (Hong Kong):
https://cloudauth-device.cn-hongkong.aliyuncs.comSingapore:
https://cloudauth-device.ap-southeast-1.aliyuncs.comIndonesia (Jakarta):
https://cloudauth-device.ap-southeast-5.aliyuncs.comUS (Silicon Valley):
https://cloudauth-device.us-west-1.aliyuncs.comGermany (Frankfurt):
https://cloudauth-device.eu-central-1.aliyuncs.comMalaysia (Kuala Lumpur):
https://cloudauth-device.ap-southeast-3.aliyuncs.com
Parameter | Description | Example |
IPv6 | Specifies whether to use an IPv6 domain name to report device information:
| "1" |
DataSwitch | Specifies when to report device information.
Note We recommend using the default setting. | "1" |
CustomUrl | The domain name of the data reporting server. | For details, see Regional CustomUrl values. |
CustomHost | The host of the data reporting server. | "cloudauth-device.ap-southeast-1.aliyuncs.com" Note This example is for the Singapore region. Hosts for other regions can be derived from the URLs listed in Regional CustomUrl values. |
Get metaInfo
- (NSString *)getMetaInfo;Your server must obtain metaInfo from the client before calling the Initialize API.
The client retrieves metaInfo and sends it to your server, which then calls the Initialize API to obtain the TransactionId.
Start verification
- (void)verifyWithCertifyId:(NSString *)certifyId
withCurrentViewController:(UIViewController *)viewController
withExtParams:(NSDictionary *)extParams
complete:(AliyunIdentityVerifyBlock)completeBlock;Parameters
Parameter | Type | Description |
certifyId | NSString | Obtained from the server-side InitializeV2 API. |
viewController | UIViewController | The current |
extParams | NSDictionary | Custom parameters. Pass For a list of supported parameters, see extParams configuration. |
completeBlock | AliyunIdentityVerifyBlock | Callback that returns the verification result upon completion. |
extParams configuration
Key | Description | Example (string) |
kIdentityParamKeyNextButtonColor | Color of the bottom button on the OCR recognition result page. | #FF0000 |
kIdentityParamKeyRoundProgressColor | Color of the circular progress indicator during the face scan. | #FF0000 |
kIdentityParamKeyOcrSelectPhoto | Whether to show the photo album upload option during ID OCR recognition:
| 1 |
kIdentityParamKeyShowOcrResult | Whether to show the recognition result page after ID OCR recognition:
| 1 |
kIdentityParamKeyEditOcrResult | Whether the recognition result page is editable during ID OCR recognition:
| 1 |
kIdentityParamKeyMaxRetryCount | Maximum number of retries. Valid values: 3 to 10. Default value: 10. | 10 |
kIdentityParamKeyCardOcrTimeOutPeriod | Timeout for OCR recognition, in seconds. Valid values: 20 to 60. Default value: 20. | 20 |
kIdentityParamKeyFaceVerifyTimeOutPeriod | Timeout for liveness detection, in seconds. Valid values: 20 to 60. Default value: 20. | 20 |
kIdentityParamKeyCardOcrEditTimeOutPeriod | Duration (in seconds) that the OCR recognition result page remains editable. Valid values: 60 to 180. By default, the duration is unlimited. | 180 |
kIdentityParamKeyLanguage | SDK display language. By default, the SDK uses the system language. Note For a list of supported languages, see Android and iOS SDK Language Customization. | zh-Hans |
kIdentityParamKeyDefaultLanguage | Default SDK language. For valid values, refer to kIdentityParamKeyLanguage. The default value is en (English). | en |
kIdentityParamKeyCloseButtonPosition | Position of the close button in the SDK UI:
| left |
kIdentityParamKeyWatermark | Watermark text displayed after successful OCR recognition. | Test watermark text |
kIdentityParamKeyProtocol | Pre-fetched SDK protocol content. Note Obtain the protocol from the server-side Initialize API and pass it here to reduce internal SDK API calls and improve startup performance. | 968412EB*******... |
Result codes
For a list of result codes and sub-codes, see Native SDK client result codes and sub-codes.
Sample code
#import "ViewController.h"
#import <AliyunIdentityPlatform/AliyunIdentityPlatform.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Initialize the sdk.
[[AliyunIdentityPlatform sharedInstance] install];
[self initUI];
}
// You must implement this function to send the metaInfo to your server and retrieve a transaction ID.
- (NSString *)sentMetaInfoAndGetTransactionId:(NSString*) metaInfo {
return @"Get the transaction ID from your server."; // TODO: Replace this with an actual call to your server.
}
- (void)onClickStart:(id) sender {
NSString *metaInfo = [[AliyunIdentityPlatform sharedInstance] getMetaInfo];
NSString *transactionId = [self sentMetaInfoAndGetTransactionId:metaInfo];
// Set the sdk language.
NSDictionary *extParams = @{
kIdentityParamKeyLanguage:@"en"
kIdentityParamKeyProtocol:@"968412EB......................."// Configure this protocol to reduce network latency.
};
// Start verification.
[[AliyunIdentityPlatform sharedInstance] verifyWithCertifyId:transactionId
withCurrentViewController:self
withExtParams:extParams
complete:^(AliyunIdentityVerifyRes *response) {
NSString *resContent = [NSString stringWithFormat:@"Code=%d Message=%@", response.code, response.message];
}];
}
- (void)initUI {
// ......
}
@endComponent trimming
You can trim some components during the SDK integration phase. To minimize the SDK package size, integrate only the components that your product requires. This ensures a complete set of features and security compliance. For detailed trimming rules, see SDK thinning instructions.