Home/Touch Id Authentication in iOS

Touch Id Authentication in iOS

Published On: 22 November 2016.By .
  • Mobile

images

What is Touch ID ?

Touch ID is Apple’s fingerprint technology for iOS mobile devices. It allows consumers to unlock their phones and make purchases conveniently using their fingerprint(s). As of iOS version 8.0, and iPhone 5s Apple opened up Touch ID to developers by making APIs available for use in the SDK.

Why to use?

it can be included in your iOS applications for security benefits .

/How to Implement?

The first and most commonly used approach to integrating Touch ID into your iOS applications is to utilize the LocalAuthentication framework. The framework exposes a class called LAContext which allows you to:

  1. Verify that the device is Touch ID capable and ready.
  2. Present an authentication dialog to the user and evaluate whether or not their provided fingerprint matched successfully or not.

we have use this code :

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

NSError *authError = nil;

NSString *myLocalizedReasonString = @"Touch ID Test to show Touch ID working in a custom app";

if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {

[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics

localizedReason:myLocalizedReasonString

reply:^(BOOL success, NSError *error) {

if (success) {

dispatch_async(dispatch_get_main_queue(), ^{

[self performSegueWithIdentifier:@"Success" sender:nil];

});

} else {

dispatch_async(dispatch_get_main_queue(), ^{

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"

message:error.description

delegate:self

cancelButtonTitle:@"OK"

otherButtonTitles:nil, nil];

[alertView show];

NSLog(@"Switch to fall back authentication - ie, display a keypad or password entry box");

});

}

}];

} else {

dispatch_async(dispatch_get_main_queue(), ^{

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"

message:authError.description

delegate:self

cancelButtonTitle:@"OK"

otherButtonTitles:nil, nil];

[alertView show];

});

}

if you have any doubt feel free to contact at any time on skype: niranjankr0

Related content

We Love Conversations

Say Hello
Go to Top