How to use iOS 8 fingerprint recognition, code, examples

Source: Internet
Author: User

As you can imagine, the fingerprint recognition in IOS 8 is handy, with just one interface, and a modal box popping up on the screen, just like the App Store.

Directly on the code, the following code is copied from Apple's official documentation.

Need to add Localauthentication.framework library, note that only the real machine has this library, the simulator does not

#import "Localauthentication/lacontext.h" lacontext *mycontext = [[Lacontext alloc] init];    Nserror *autherror = nil;        NSString *mylocalizedreasonstring = @ "Please enter fingerprint"; if ([Mycontext canevaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics Error:&autherror]) {[MyContex                            T Evaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics localizedreason:mylocalizedreasonstring                                    reply:^ (BOOL success, Nserror *error) {if (success) { User authenticated successfully, take appropriate action} ELS e {//User did not authenticate successfully, look at error and take appropriate actio    n}}]; } else {//Could not evaluate policy, look at Autherror and present a appropriate message to user}


Effect: Myaddressbook is the name of my app, "Please enter a fingerprint" is a string in the code



It's still very simple.


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.