ios-fingerprint identification

Source: Internet
Author: User

- (void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *)Event{    //1. Judging the system version    if([Uidevice Currentdevice].systemversion.floatvalue >=8.0) {        //can use fingerprint identification--5S later modelsLacontext *context =[[Lacontext alloc] init]; if([Context canevaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics Error:nil]) {//can use//3. Start enabling fingerprint recognition//Localizedreason: The reason that is displayed on the interface, is generally used to prompt the user, why use this feature[Context Evaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics Localizedreason:@"Please verify the fingerprint to turn on advanced hide feature"reply:^ (BOOL success, Nserror *_nullable Error) {                                //Judging whether it is successful                if(Success) {//4. Fingerprint recognition when updating the UI, be aware that the main thread updateDispatch_sync (Dispatch_get_main_queue (), ^{[Self Createuialertcontroller:@"Validation Successful"];                                                        }); } Else{Dispatch_sync (Dispatch_get_main_queue (),^{[Self Createuialertcontroller:@"validation Failed"];                }); }                //Judging errors If you need to distinguish between different errors to prompt for, you must determine the error                if(Error) {NSLog (@"error Code:%ld", Error.code); NSLog (@"Error:%@", Error.userinfo);        }            }]; } Else{NSLog (@"Sorry, this feature is only available for models above 5S"); }            } Else{NSLog (@"Sorry, the system version is too low"); }    }-(void) Createuialertcontroller: (nsstring*) title{Uialertcontroller* Alert =[uialertcontroller Alertcontrollerwithtitle:@"Tips"Message:title Preferredstyle:uialertcontrollerstylealert]; Uialertaction* Action =[uialertaction Actionwithtitle:@"Confirm"Style:uialertactionstyledefault handler:^ (Uialertaction *_nonnull Action)    {            }]; Uialertaction* Action1 =[uialertaction Actionwithtitle:@"Cancel"Style:uialertactionstylecancel handler:^ (Uialertaction *_nonnull Action)    {    }];    [Alert Addaction:action1];    [Alert addaction:action]; [Self Presentviewcontroller:alert animated:yes completion:nil];}

ios-fingerprint identification

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.