Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS Fingerprint implementation

Since Apple has release Xcode 5 which features FingerPrint scanning in iOS 7, Can we implement this in our app? if yes which SDK do we use for implementation.

Please provide a sample code or else specify which SDK do we use.

like image 531
sKhan Avatar asked Sep 23 '13 07:09

sKhan


2 Answers

No the fingerprint scanner is not available to developers, it is available in the current SDK.

With the upcoming iOS 8 SDK you will be able to use the fingerprintscanner via the official SDK.

You can read more about TouchID in the What's New in iOS: iOS8 document.

like image 129
rckoenes Avatar answered Oct 15 '22 12:10

rckoenes


It can be achieved by using LAContext(Local Authentication framework) which can be use to evaluate a security policy.It checks, using the Touch ID sensor, that the person authenticating is the device owner. In the future there may be other security policies.

Here is the code snippet for the same:

-(void)handlerForFingerTouch{
   LAContext *context = [[LAContext alloc] init];

   NSError *error = nil;
   if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
       [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
               localizedReason:@"Are you the device owner?"
                         reply:^(BOOL success, NSError *error) {

           if (error) {
               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                               message:@"There was a problem verifying your identity."
                                                              delegate:nil
                                                     cancelButtonTitle:@"Ok"
                                                     otherButtonTitles:nil];
               [alert show];
               return;
           }

           if (success) {
               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success"
                                                               message:@"You are the device owner!"
                                                              delegate:nil
                                                     cancelButtonTitle:@"Ok"
                                                     otherButtonTitles:nil];
               [alert show];

           } else {
               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                               message:@"You are not the device owner."
                                                              delegate:nil
                                                     cancelButtonTitle:@"Ok"
                                                     otherButtonTitles:nil];
               [alert show];
           }

       }];

   } else {

       UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                       message:@"Your device cannot authenticate using TouchID."
                                                      delegate:nil
                                             cancelButtonTitle:@"Ok"
                                             otherButtonTitles:nil];
       [alert show];

   }
}
like image 42
sKhan Avatar answered Oct 15 '22 14:10

sKhan