I am using this below code for detecting the Touch ID availability in device it works fine
- (BOOL)canAuthenticateByTouchId
{
if ([LAContext class])
{
return [[[LAContext alloc] init] canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil];
}
return NO;
}
- (IBAction)touchIDAvailability
{
if([self canAuthenticateByTouchId])
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congrats"
message:@"Your device have TouchID"
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
else
{
str = @"TouchID is not available in your device";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops"
message:str
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
}
After detecting the Touch ID availability i want to find the Touch Id is configured or not
NSString *str;
if (LAErrorTouchIDNotEnrolled)
{
str = @"Please configure your TouchID in Settings > Touch ID & Passcode";
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops"
message:str
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
i configured Touch ID but it still Entered into LAErrorTouchIDNotEnrolled this loop. Can any one knows tell me.
You can check whether user is configured or not using below
Here is the complete code for Touch ID
Hope it helps you..!