Created
April 21, 2016 13:15
-
-
Save bouchtaoui-dev/d70a2b3bd5c75f6374c5d863fa9efffc to your computer and use it in GitHub Desktop.
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
| #import <LocalAuthentication/LocalAuthentication.h> | |
| /* A very simple way to scan your fingerprint... */ | |
| - (IBAction)didPressScan:(UIButton *)sender { | |
| NSLog(@"Hallo...!"); | |
| LAContext *myContext = [[LAContext alloc] init]; | |
| NSError *authError = nil; | |
| NSString *myLocalizedReasonString = @"Used for quick and secure access to the Remob app :P"; | |
| if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) { | |
| [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics | |
| localizedReason:myLocalizedReasonString | |
| reply:^(BOOL success, NSError *error) { | |
| if (success) { | |
| // User authenticated successfully, take appropriate action | |
| NSLog(@"Yes baby! Fingerprint scanned!"); | |
| } else { | |
| // User did not authenticate successfully, look at error and take appropriate action | |
| NSLog(@"Damn you! I failed to defeat the dragon claw!"); | |
| } | |
| }]; | |
| } else { | |
| // Could not evaluate policy; look at authError and present an appropriate message to user | |
| NSLog(@"Say what! No authentication?!"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment