Fingerprint and face recognition

1. Fingerprint Identification 1. Introduction to fingerprint recognition The iPhone 5S begins to have fingerprint recogn...
1. Fingerprint Identification 1. Introduction to fingerprint recognition

The iPhone 5S begins to have fingerprint recognition
Starting with ios8.0, Apple opened a verification interface for fingerprint recognition: LocalAuthentication

2. Call mechanism
Give three consecutive opportunities, after which you will be prompted for the remaining two opportunities, password login, cancellation of fingerprint verification
FINGERPRINT IDENTIFICATION BOUND WITH FIVE INPUT ERRORS

The second call to fingerprint recognition, such as the logic above, requires a lock screen to enable fingerprint recognition if it has not been verified to pass

3. Paste code

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { //1. Judging System Version if ([UIDevice currentDevice].systemVersion.floatValue >= 8.0) { // You can use fingerprint recognition - > 5S later models //2. Determine if the model supports fingerprint recognition //2.1. Create LA object context LAContext *context = [[LAContext alloc] init]; //2.2. Judging whether to use /** @param LAPolicy Assessment @return strategy */ if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]) { //have access to //3. Turn on fingerprint recognition /** @param LAPolicy You can use fingerprint recognition strategies @param localizedReason Prompt user for information */ [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"Please put your chicken paws on home Verify fingerprint on key" reply:^(BOOL success, NSError * _Nullable error) { //Determine success if (success) { NSLog(@"Verification successful"); dispatch_sync(dispatch_get_main_queue(), ^{ //Update UI in main thread }); } else { NSLog(@"Validation failed"); } if (error) { switch (error.code) { case -1: NSLog(@"Out of validation limit, prompt to lock screen, re-validate!"); break; case -2: NSLog(@"User clicked to cancel fingerprint verification"); break; case -3: NSLog(@"Click Password to Login"); break; case -8: NSLog(@"Lock screen function is locked, lock screen phone, password login to enable fingerprint recognition!"); break; default: break; } } }]; } else { NSLog(@"Sorry, 5 s Only the above models can use this function"); } } else { NSLog(@"System version is too low to use fingerprint recognition!"); } }


2. Face Recognition

10 July 2020, 10:46 | Views: 5281

Add new comment

For adding a comment, please log in
or create account

0 comments