IOS SDK app with Touch ID authentication

Source: Internet
Author: User

Original blog, reproduced please indicate the source
Blog.csdn.net/hello_hwc

After iOS 8.0, Apple has opened an app that uses Touch ID to authenticate. But there are a few things to note:

    • The app simply proxies the authentication process to the iOS system and does not get specific information about the fingerprint.
    • Do not try to compare the fingerprint information with other databases, it is impossible for me to write this day.
Used by

Start validation

Validation failed

Supported devices
    • IPhone 5s +
    • IPad Air 2 +
    • IPad Mini 3 +

How to use
Framework used by import

#import <LocalAuthentication/LocalAuthentication.h>

Initialize a Lacontext

  LAContext * context = [[LAContext alloc] init];

Check whether the current device supports TouchID

NSError * error = nil;    if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {    ...}

Touch ID Authentication if supported

[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"To login in" reply:^(BOOLNSError *error) {            if (success) {                //成功            }else{                   //失败            }}];   

Of these, there are several types of error that failed to return

    • Laerrorauthenticationfailed-fingerprint authentication failed
    • Laerrorusercancel-User cancels authentication (e.g. click Cancel)
    • Laerroruserfallback-User Cancel (click input password)
    • Laerrorsystemcancel-System Cancel
    • Laerrorpasscodenotset-System does not have a password set
    • Laerrortouchidnotavailable-Device does not support TouchID
    • Laerrortouchidnotenrolled-touch ID not set (one fingerprint not)

IOS SDK app with Touch ID authentication

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.