iOS fingerprint recognition

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.