Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Integrating Biometric (Touch Id) Authentication in iOS Application?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 537
    Comment on it

    iOS 8 SDK by Apple provides Local Authentication API that allows developers to integrate Touch Id authentication in applications.

    To integrate Touch Id authentication follow the below steps:

    • Import Local Authentication framework in your controller.
                  import LocalAuthentication
    • Use the following function to the authentic user:

      

     func authenticateUser(){
            let authenticationContext = LAContext()
            var error:NSError?
            
            // 2. Check if the device has a fingerprint sensor
            // If not, show the user an alert view and bail out!
            
    guard authenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
    
                // SHOW MESSAGE HERE
                return
                
            }
            
            // 3. Check the fingerprint
            authenticationContext.evaluatePolicy(
                .deviceOwnerAuthenticationWithBiometrics,
                localizedReason: "Identify Yourself",
                reply: { [unowned self] (success, error) -> Void in
                    
                    if( success ) {
                        // Fingerprint recognized
                        // The success code goes here
                                       
                    }else {
                            // Check if there is an error
                        if let error = error {
                           // Error Occured
                          // The error code goes here
                        }
                        
                    }
                    
                })
            
        }
    
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: