After IOS8, Apple released the fingerprint recognition function, uses the Touch ID to identify the user, makes the user authorization, mainly relies on the Localauthentication library
Fingerprint identification: One to determine whether the device supports fingerprint recognition function
Two fingerprint identification, after the success of the corresponding action, failure to remind the user fingerprint recognition failed
First introduce#import <LocalAuthentication/LocalAuthentication.h>
Lacontext *context = [[Lacontext alloc] init];
Nserror *error = nil; Verify that fingerprint recognition is supported if ([Context Canevaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics Error:&error]) {NSL
OG (@ "Support fingerprint identification application"); Authentication [Context Evaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics localizedreason:nslocalizedstring (
@ "Need fingerprints to verify your identity", @ "Hello") reply:^ (BOOL success, Nserror *error) {if (success) {NSLog (@ "successful"); else {switch (error.code) {case Laerrorusercancel:nslog (@ "User cancelled authorization-%@", error.localize
Ddescription);
Break
Case Laerroruserfallback:nslog (@ "user clicks on" Enter Password "button-%@", error.localizeddescription);
Break
Case Laerrorauthenticationfailed:nslog (@ "You have been authorized to fail 3 times-%@", error.localizeddescription);
Break
Case Laerrortouchidlockout:nslog (@ "Fingerprint is locked-%@", error.localizeddescription);
Break Case LaerrorSystemcancel:nslog (@ "app goes backstage-%@", error.localizeddescription);
Break
Default:nslog (@ "++%@--%zd", Error.localizeddescription, Error.code);
Break
}
}
}]; else {switch (error.code) {case Laerrorpasscodenotset:nslog (@ "Not set password-%@", Error.localizeddescripti
ON);
Break
Case Laerrortouchidnotenrolled:nslog (@ "not registered touch ID-%@", error.localizeddescription);
Break
Case Klaerrortouchidnotavailable:nslog (@ "This device does not support touch ID-%@", error.localizeddescription);
Break
Default:nslog (@ "--%@--%zd", Error.localizeddescription, Error.code);
Break }
}