One that's being developed recently app Need to add fingerprint recognition function , Search for official documents first , Simple and easy to understand :

The main purpose of fingerprint identification should be to determine whether the current user is the host , Wrote a demo Simple experience :

1 First of all, we need to introduce fingerprint identification library

2 Import and stock in

#import "LocalAuthentication/LAContext.h"

3 Key code

 LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = @"We need to verify your fingerprint to confirm your identity"; // Judge whether the device supports fingerprint identification
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) { // Fingerprint identification only determines whether the current user is the host or not
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
reply:^(BOOL success, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
NSLog(@" Fingerprint authentication successful "); returnCode = @"1"; } else {
// User did not authenticate successfully, look at error and take appropriate action
NSLog(@" Fingerprint authentication failed ,%@",error.description);
// Error code error.code
// -1: Three consecutive fingerprint identification errors
// -2: stay TouchID Click the Cancel button in the dialog box
// -3: stay TouchID Click the enter password button in the dialog box
// -4: TouchID The dialog box was cancelled by the system , For example, press Home Or power button
// -8: Five consecutive fingerprint identification errors ,TouchID Function locked , Next time you need to enter the system password returnCode = [@(error.code) stringValue];
}]; } else {
// Could not evaluate policy; look at authError and present an appropriate message to user
NSLog(@"TouchID The device is not available ");
// TouchID No fingerprint set
// Close password ( If the system does not set a password TouchID Unable to enable ) }

4 Get it done !


After fingerprint authentication failure TouchID A “ Input password ” The button , I thought that clicking this button would pop up the password input interface of the system , But it's not ,error.code The value of is -3, After that, there were a lot of questions , such as “ What if the system doesn't set a password ?”,“ Can you change the password button to cancel or remove it ”,“ Why do I need it TouchID, It doesn't seem to make any sense ”..

After testing, the following conclusions are obtained :

a. If the system does not set a password ,TouchID It cannot be enabled , Turn on TouchID The system will force you to set a password

b. “ Input password ” The button should provide us with the entrance to integrate our own business authentication mechanism , Like alipay , You can pay through TouchID fingerprint identification , You can also complete the payment by entering the payment password

c. Why TouchID Fingerprint identification function ? Personally think that TouchID This function should not be involved APP In the business consideration scenario , Whether you have the equipment or not TouchID,app They should have their own authentication mechanism , Do you have business in this way TouchID It makes sense in all kinds of devices ,Android The same goes for platforms . as for TouchID This function , It should be an additional convenience function , With , That would be convenient , User experience will be better , If not, it doesn't matter .

IOS Fingerprint identification calls more related articles

  1. iOS fingerprint identification Touch ID Discussion on the safety of medical equipment

    Apple at iPhone 5s The new fingerprint identification security technology was announced at the press conference , That is to say  Touch ID, It creates a new chapter of biosafety identification technology used in portable devices . thereafter , Apple has also brought this technology to the market iPad On . There have been no previous reports ...

  2. iOS fingerprint identification

    #import "ViewController.h" #import <LocalAuthentication/LocalAuthentication.h> @inte ...

  3. IOS Simple use of fingerprint identification

    First, import. LocalAuthentication frame Then import the header file #import <LocalAuthentication/LAPublicDefines.h> - (void)begi ...

  4. iOS Fingerprint identification code

    1: add to LocalAuthentication.framework frame 2: Implementation process #import "ViewController.h" #import <LocalAut ...

  5. ios Fingerprint identification unlocking

    : add to LocalAuthentication.framework frame : Implementation process #import "ViewController.h" #import <LocalAuthe ...

  6. Fingerprint recognition and face recognition iOS

    //1. Judge iOS8 And later versions if([UIDevice currentDevice].systemVersion.doubleValue >= 8.0){ // from iPhone5S Start , Emergence refers to ...

  7. Swift Call down Touch ID Realize fingerprint identification

    iOS Develop communication groups :484884085 Welcome to add . For example, the following code is an implementation call 5S Fingerprint identification code of the above equipment , According to the code given on the official website , It will appear after a long time after successful identification. , It's been a long time . Just know to put it in ...

  8. iOS - TouchID fingerprint identification

    Preface NS_CLASS_AVAILABLE(10_10, 8_0) @interface LAContext : NSObject Fingerprint identification function is iPhone 5s To launch the ,SDK yes iOS 8. ...

  9. ios Development - fingerprint identification

    When we used Alipay software recently, , We found that we could use fingerprints , Does it look tall . At that time, Apple launched the relevant interface , It's easy to write the program . stay iPhone5s When , Apple launched fingerprint unlock . But in ios8.0 It's the apple that pushes when it's on the road ...

Random recommendation

  1. SQL Server Understanding of implementation plan

    See in detail : Summarize yourself : scanning Scan: Traverse data line by line . lookup Seek: According to the query conditions , Navigate to the local location of the index , then ...

  2. Detailed explanation SESSION And COOKIE The difference between

    stay PHP During the interview Often encountered, please elaborate session And cookie The difference and connection , And how to modify the effective time of the two . Everybody knows ,session It's stored on the server side ,cookie It's stored on the client side ,session Depend on c ...

  3. 【Lua】Debian In the environment openresty Installation

    OpenResty ( Also known as ngx_openresty) It's a full-featured Web application server , It's packed with standard  Nginx  The core , Many common third-party modules , And most of their dependencies . OpenResty  through ...

  4. Using change tracking (ChangeTracking) To change the data type

    In the real world , We often encounter the scenario of modifying the data type , Especially the self increasing column from INT It is amended as follows BIGINT The situation of , Autoincrement columns are usually used as primary keys and clustered index keys of tables , Therefore, the modification operation needs to be carried out according to the following steps 1. Stop accessing the table ( Through the right of prohibition ...

  5. linux System programming files and IO( Four ): Directory access related system calls

    1. System calls related to directory operations     1.1 mkdir and rmdir system call     1.1.1 example     1.2 chdir, getcwd system call     1.2.1 example     1.3 o ...

  6. Distributed service framework Zookeeper — Manage data in a distributed environment

    This section was meant to introduce ZooKeeper Implementation principle of , however ZooKeeper It's complicated , It involves paxos Algorithm .Zab agreement . Communication protocol and other related knowledge , It's more abstract to understand, so we need to use some application scenarios , To help us understand . ...

  7. Description of software architecture -Architecture Models

    Software architecture involves the high level structure of software system abstraction, by using dec ...

  8. GridView Easy to use

    This is the effect picture Today I saw this code and found a problem   It's mine. listView The layout is not right   my GridView Of android:layout_height="wrap_content&quo ...

  9. JS Call in android and ios The system phone can turn on the camera and select the photo album function

    It's not easy to write , If reproduced , Please state the source : Dream back to the estuary : Realization android Turn on the camera and select the album ...

  10. ALPHA sprint ( One )

    Catalog Team members Team members 1( group leader ): Hu Xupei Team members 2: Hu Qingyuan Team members 3: Zhuang Hui Team members 4: Jiacan Team members 5: Karin Team members 6: Danny Team members 7: Jiawei Team members 8: Political performance Team members 9: Huang Hongjie Team members 10: Liu Yihao Team members 11: He Yuheng In show group ...