IOS SDK details: Apps use Touch ID authentication, iossdk
Original Blog, reprinted, please indicate the source
Blog.csdn.net/hello_hwc
Since iOS 8.0, Apple has enabled the App to use Touch ID for authentication. Note the following points:
- The App only proxies the authentication process to the iOS system and does not obtain the specific fingerprint information.
- Do not try to compare the fingerprint information with other databases. It is still impossible on the day I wrote it.
Used
Start verification
Verification Failed
Supported Devices
- IPhone 5S +
- IPad Air 2 +
- IPad Mini 3 +
How to Use
Framework used for Import
#import <LocalAuthentication/LocalAuthentication.h>
Initialize a LAContext
LAContext * context = [[LAContext alloc] init];
Check whether the current device supports TouchID
NSError * error = nil; if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) { ...}
If yes, perform Touch ID authentication.
[Context evaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason: @ "To login in" reply: ^ (BOOL success, NSError * error) {if (success) {// success} else {// failure}];
There are several Error types returned for failure.
- LAErrorAuthenticationFailed-Fingerprint Authentication failed
- LAErrorUserCancel-the user cancels the authentication (for example, click cancel)
- LAErrorUserFallback-cancel a user (click "password)
- LAErrorSystemCancel-system canceled
- LAErrorPasscodeNotSet-no password set in the system
- LAErrorTouchIDNotAvailable-the device does not support TouchID
- LAErrorTouchIDNotEnrolled-Touch ID is not set (none for one fingerprint)