ios 指纹验证

    LAContext *myContext = [[LAContext alloc] init];

    NSError *authError = nil;

    NSString *myLocalizedReasonString = @"String explaining why app needs authentication";

    

    if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometricserror:&authError]) {

        [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics

                  localizedReason:myLocalizedReasonString

                            reply:^(BOOL success, NSError *error) {

                                if (success) {

                                    // User authenticated successfully, take appropriate action

                                    NSLog(@"User authenticated successfully, take appropriate action");

                                } else {

                                    // User did not authenticate successfully, look at error and take appropriate action

                                    NSLog(@"User did not authenticate successfully, look at error and take appropriate action");

                                }

                            }];

    } else {

        // Could not evaluate policy; look at authError and present an appropriate message to user

        NSLog(@"Could not evaluate policy: %@",authError);

    }

猜你喜欢

转载自yelon.iteye.com/blog/2200284
今日推荐