Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. LAContext *myContext = [[LAContext alloc] init];
  2. NSError *authError = nil;
  3. NSString *myLocalizedReasonString = <#String explaining why app needs authentication#>;
  4.  
  5. if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
  6. [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
  7. localizedReason:myLocalizedReasonString
  8. reply:^(BOOL success, NSError *error) {
  9. if (success) {
  10. // User authenticated successfully, take appropriate action
  11. } else {
  12. // User did not authenticate successfully, look at error and take appropriate action
  13. }
  14. }];
  15. } else {
  16. // Could not evaluate policy; look at authError and present an appropriate message to user
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement