Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't check Face ID when user denied to use

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

like image 631
Furkan yeşiloğlu Avatar asked Jan 22 '18 13:01

Furkan yeşiloğlu


1 Answers

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.

like image 89
markedwardmurray Avatar answered Sep 30 '22 17:09

markedwardmurray