After iOS8, Apple released the fingerprint recognition function, which uses touch ID to identify users and authorize users, mainly relying on the LocalAuthentication library
Fingerprint recognition: A determination of whether the device supports fingerprint recognition function
Secondly, recognize fingerprints, make corresponding actions after success, and remind the user to fail to recognize fingerprints after failure.
Introduce first#import <LocalAuthentication/>
LAContext *context = [[LAContext alloc] init]; NSError *error = nil; //Verify whether fingerprint recognition is supported if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) { NSLog(@"Apps that support fingerprint recognition"); //Verify identity [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:NSLocalizedString(@"Fingerprints are required to verify your identity", @"hello") reply:^(BOOL success, NSError *error) { if (success) { NSLog(@"success"); } else { switch () { case LAErrorUserCancel: NSLog(@"The user has cancelled the authorization - %@", ); break; case LAErrorUserFallback: NSLog(@"The user clicked the "Enter Password" button - %@", ); break; case LAErrorAuthenticationFailed: NSLog(@"You have failed authorization 3 times - %@", ); break; case LAErrorTouchIDLockout: NSLog(@"Fingerprint locked - %@", ); break; case LAErrorSystemCancel: NSLog(@"Application enters the background - %@", ); break; default: NSLog(@"++%@--%zd", , ); break; } } }]; } else { switch () { case LAErrorPasscodeNotSet: NSLog(@"Password not set - %@", ); break; case LAErrorTouchIDNotEnrolled: NSLog(@"Unregistered Touch ID - %@", ); break; case kLAErrorTouchIDNotAvailable: NSLog(@"This device does not support Touch ID - %@", ); break; default: NSLog(@"--%@--%zd", , ); break; } }