how to determine whether the ios device is a face or a touch?

186 Views Asked by At

when I turn off face id on the setting,I get a error as follow:

    LAContext *myContext = [[LAContext alloc] init];
    NSError *authError = nil;
    [myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]

authError is "No identities are enrolled." This error does not indicate whether the phone is touch id or face id,how I determine whether the ios device is a face or a touch?

I have tried differnt iphone device,authError is "No identities are enrolled.". I can not determine whether the ios device is a face or a touch.

1

There are 1 best solutions below

0
Paulw11 On

The biometryType property of the LAContext object tells you what type of biometric authentication is available on the current device:

LAContext *myContext = [[LAContext alloc] init];
switch (myContext.biometryType) {
    case LABiometryTypeFaceID:
        // Do something with Face ID
    break;

    case LABiometryTypeTouchId:
       // Do something with Touch ID
    break;

    case LABiometryTypeNone:
       // Biometrics are not available
}