I want to take different actions to users if device support Face ID or Touch ID.
When using the Face ID, iOS asking permission to use. (unlike Touch ID).
And if the user denies permission, context.biometryType return LABiometryTypeNone.
Is there anyway to check Touch ID or Face ID supported by device.
LAContext *context = [[LAContext alloc] init];
NSError *error;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
}
if (@available(iOS 11.0, *)) {
if (context.biometryType == LABiometryTypeFaceID) {
// support FaceID
}
}
// support TouchID
Console output
(lldb) po error
Error Domain=com.apple.LocalAuthentication Code=-6 "User has denied the use of biometry for this app." UserInfo={NSLocalizedDescription=User has denied the use of biometry for this app.}
(lldb) po context.biometryType
LABiometryTypeNone
NOTE: I Don't want to use passcode authentication. I just need to know device is support Touch ID or Face ID
No. If the user denies the Privacy Permissions prompt with the NSFaceIDUsageDescription
, all future instances of LAContext
will have a biometryType
property of .none
once canEvalutePolicy:error:
is called on them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With