1-(void) createfingerprint{2Lacontext *mycontext =[[Lacontext alloc] init];3Nserror *autherror =Nil;4NSString *mylocalizedreasonstring =@"Please verify that you have a fingerprint";5 6 //determine if the device supports fingerprint identification7 if([Mycontext canevaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics error:&Autherror]) {8 if([[[[Nsuserdefaults Standarduserdefaults]objectforkey:@"Zhiwenshibie"]isequaltostring:[finance_tools GetUserID]]) {Ten //Fingerprint identification only determines whether the current user is the master of the machine A [Mycontext evaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics - localizedreason:mylocalizedreasonstring -reply:^ (BOOL success, Nserror *error) { the if(Success) { - //User authenticated successfully, take appropriate action -NSLog (@"Fingerprint authentication Successful"); -Dispatch_async (Dispatch_get_main_queue (), ^{ + -[Self createtixiandownload:[[nsuserdefaults standarduserdefaults] Objectforkey:@"PassWord"]]; + }); -}Else { -NSLog (@"fingerprint authentication failed,%@", error.description); - inDispatch_async (Dispatch_get_main_queue (), ^{ - to //back to main thread action code block + if([[@ (Error.code) stringvalue] isequaltostring:@"-2"]|| [@ (Error.code) stringvalue] isequaltostring:@"-4"]) { -}Else if([[@ (Error.code) stringvalue] isequaltostring:@"-3"]|| [@ (Error.code) stringvalue] isequaltostring:@"-8"]|| [@ (Error.code) stringvalue] isequaltostring:@"-1"]){ the //Failure reason, popup box enter password * $ }Panax Notoginseng - }); the + A } the }]; + -}Else{ $ //Turn on fingerprint identification $ } -}Else { - //Could not evaluate policy, look at Autherror and present a appropriate message to user theNSLog (@"TouchID device is not available"); - //TouchID no fingerprint setWuyi //Turn off password (System if not set password TouchID cannot be enabled) the -Pop-up bullet box enter password
About}
*
Reason for failure:
1NSLog (@"fingerprint authentication failed,%@", error.description);2 //Error code Error.code3 //-1: Three consecutive fingerprint recognition errors4 //-2: Click the Cancel button in the TouchID dialog box5 //-3: Click the Enter Password button in the TouchID dialog box6 //The -4:touchid dialog is canceled by the system, for example, by pressing home or the Power key7 //-8: Five consecutive fingerprint recognition errors, TouchID function is locked, the next time you need to enter the system password8
iOS fingerprint recognition