This document explains how to integrate the AliyunMetaVerify identity verification solution for iOS.
Prerequisites
-
OS version: iOS 9.0 or later
-
Supported languages: Objective-C, Swift
Configure the development environment
-
Configure camera and photo library permissions in the info.plist file.
Add the
Privacy - Camera Usage Descriptionkey and set its value toCamera access is required for verification. Add thePrivacy - Photo Library Usage Descriptionkey and set its value toPhoto library access is required to select documents. -
In your Xcode project's Build Settings, go to Linking > Other Linker Flags and add the -ObjC setting.
Configure dependencies
Download and unzip AliyunMetaVerify.zip. In Xcode, add the five packages from the SDK and the necessary system library dependencies to Link Binary With Libraries.
-
SDK packages:
MNN.framework AliyunOSSiOS.framework AliyunMetaVerifyFacade.framework AliyunMetaVerifyOCR.framework AliyunMetaVerifyUtils.framework -
System libraries:
CoreML.framework CoreVideo.framework CoreMotion.framework AdSupport.framework SystemConfiguration.framework CoreTelephony.framework Accelerate.framework libz.tbd libresolv.tbd libc++.tbd libsqlite.tbd
Copy resource files
Select TARGETS, click the Build Phases tab, and add the following bundles to Copy Bundle Resources:
-
AliyunMetaVerifyFacade.bundle: Located in AliyunMetaVerifyFacade.framework.
-
AliyunMetaVerifyOCR.bundle: Located in AliyunMetaVerifyOCR.framework.
If AliyunMetaVerifyFacade.bundle and AliyunMetaVerifyOCR.bundle appear in Compile Sources, remove them.
Call the SDK
Import the header file
#import <AliyunMetaVerifyFacade/AliyunMetaVerifyFacade.h>
Initialize the SDK
- (BOOL)application:(UIApplication)application didFinishLaunchingWithOptions:(NSDictionary)launchOptions {
[[AliyunMetaVerifyFacade sharedInstance] install];
}
Get MetaInfo data
[[AliyunMetaVerifyFacade sharedInstance] getMetaInfo];
Start verification
Before calling this method, pass the MetaInfo to your server and obtain the certifyId by calling the InitCardVerify API.
[[AliyunMetaVerifyFacade sharedInstance] verifyWithCertifyId:certifyId withCurrentViewController:self withExtParams:nil complete:^(AliyunMetaVerifyRes *response) {
NSLog(@"Code=%d Message=%@", response.code, response.message);
}];
-
Parameters:
Parameter
Type
Description
certifyId
NSString
Obtained by calling the InitCardVerify API on your server.
viewController
UIViewController
The current view controller of your app.
extParams
NSDictionary
Reserved for future use. Pass
nil.complete
AliyunMetaVerifyRes
The callback triggered when verification is complete. It contains the verification result. For details about the return codes, see the following table.
-
Return code table:
Return code
Billed
Description
1000
Yes
The user completed verification, and the suggested result is Pass. This is a reference result only. To get the final result, call the server-side CheckResult API.
1001
Yes
The user completed verification, and the suggested result is Fail. This is a reference result only. To get the final result and failure reason, call the server-side CheckResult API.
1002
No
A system error occurred.
1003
No
The SDK failed to initialize. Make sure that the client time is correct.
1004
No
A camera error occurred. To resolve this issue, perform the following steps:
-
Before you start the verification, make sure that your app has obtained camera permission.
-
If the permission error persists after you grant permission, clear the app cache and try again.
1005
No
A network error occurred.
1006
No
The user quit the process.
1007
No
The certifyId is invalid.
1009
No
The client timestamp is invalid.
1011
No
The submitted document type is incorrect.
1012
No
Key information is missing from the recognized document, or the format verification failed.
1013
No
The image quality is poor.
1014
No
The number of attempts exceeds the limit.
-
Demo package
Download the AliyunMetaVerifyDemo.zip.