Developer/iOS

[iOS]Touch ID 사용 가능한지 판단하는 함수.

블로blow 2015. 9. 14. 15:15
728x90

LAContext *myContext = [[LAContext alloc] init]; NSError *authError = nil; NSString *myLocalizedReasonString = @"Authenticate using your finger"; //이 함수에서 사용 가능한지 판단.

if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {

[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:myLocalizedReasonString reply:^(BOOL success, NSError *error) {

if (success) { NSLog(@"User is authenticated successfully"); } else { }

}










728x90