IOS8 using TouchID

Source: Internet
Author: User

IOS8 has added the localauthentication Framework for the authorization use of TouchID. For the moment, the user's device is required to support fingerprint identification and a lock screen is set up, and the feedback is slower during the actual test. Can not directly with the third-party account password binding, assuming the need to implement a third-party application of direct fingerprint identification login, need to store account information locally, fingerprint identification through the local read account information to log in. Anyway. Fingerprint identification is now tied to device and device lock screen password.

Test code:

Use touchid-(void) usingtouchid{lacontext *mycontext = [[[Lacontext alloc] init] autorelease];    Nserror *autherror = nil;    NSString *mylocalizedreasonstring = @ "for fingerprint login"; 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 N                                    SLog (@ "Success"); Uialertview *alertview = [[[Uialertview alloc] initwithtitle:@ "suceess" message:@ "has been identified by fingerprint.                                    "Delegate:self cancelbuttontitle:nil otherbuttontitles:@" OK ", nil] autorelease];                                [Alertview show];                   } else {                 User did not authenticate successfully, look at error and take appropriate action                                    NSLog (@ "fail with error:%@", error); Uialertview *alertview = [[[Uialertview alloc] initwithtitle:@ "Failed" Message:[error Localizeddescription] Delegate:                                    Self cancelbuttontitle:nil otherbuttontitles:@ "OK", nil] autorelease];                                [Alertview show];    }                            }]; } else {//Could not evaluate policy, look at Autherror and present a appropriate message to user NSLog (@ "        Auth with error:%@ ", autherror); Uialertview *alertview = [[[Uialertview alloc] initwithtitle:@ "Failed" Message:[autherror Localizeddescription]        Delegate:self cancelbuttontitle:nil otherbuttontitles:@ "OK", nil] autorelease];    [Alertview show]; }}



IOS8 using TouchID

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.