1: Add localauthentication.framework frame2: the implementation process#import "ViewController.h"#import<LocalAuthentication/LAContext.h>@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; Lacontext*mycontext =[[Lacontext alloc]init]; Mycontext.localizedfallbacktitle=@"Forgot Password"; Nserror*error =Nil; NSString*mylocalizedreasonstring =@"Please enter a fingerprint"; if([Mycontext canevaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics error:&ERROR]) {[Mycontext Evaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics localize dreason:mylocalizedreasonstring Reply:^ (BOOL success, Nserror *error) { if(Success) {NSLog (@"Success"); } Else { //User did not authenticate successfully, look at error and take appropriate actionNSLog (@"Did not authenticate successfully"); } }]; } Else { //Could not evaluate policy, look at Autherror and present a appropriate message to userNSLog (@"Could not evaluate policy"); } }
iOS fingerprint identification unlock