Touch Id Authentication in iOS
- Mobile
Touch Id Authentication in iOS
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:
- Verify that the device is Touch ID capable and ready.
- Present an authentication dialog to the user and evaluate whether or not their provided fingerprint matched successfully or not.
we have use this code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
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
Auriga: Leveling Up for Enterprise Growth!
Auriga’s journey began in 2010 crafting products for India’s