Skip to content

Instantly share code, notes, and snippets.

@tacryt-socryp
Forked from jstart/touchID
Last active July 28, 2017 18:07
Show Gist options
  • Save tacryt-socryp/16bb050912b181cf96e6680cdea0d3c4 to your computer and use it in GitHub Desktop.
Save tacryt-socryp/16bb050912b181cf96e6680cdea0d3c4 to your computer and use it in GitHub Desktop.
Touch ID Example
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:@"Authenticate to access secure information"
reply:^(BOOL success, NSError *error) {
if (success) {
NSLog(@"User is authenticated successfully");
} else {
NSLog(@"Authentication Fails");
}
}];
} else {
NSLog(@"Can not evaluate Touch ID");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment