Skip to content

Instantly share code, notes, and snippets.

@kurtisdunn
Created July 11, 2015 12:37
Show Gist options
  • Save kurtisdunn/3ff65446eb83be95284c to your computer and use it in GitHub Desktop.
Save kurtisdunn/3ff65446eb83be95284c to your computer and use it in GitHub Desktop.
Touch ID -Objective-C
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myReasonString = @"String explaining why app needs authentication";
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myReasonString
reply:^(BOOL succes, NSError *error) {
if (success) {
// User authenticated successfully
} else {
// Authenticate failed
}
}];
} else {
// Could not evaluate policy; check authError
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment