Created
July 11, 2015 12:37
-
-
Save kurtisdunn/3ff65446eb83be95284c to your computer and use it in GitHub Desktop.
Touch ID -Objective-C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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