Home iOS Development swift – iOS getting `biometryNotAvailable` error when device supports biometry

swift – iOS getting `biometryNotAvailable` error when device supports biometry

0

[ad_1]

If user doesn’t opts to use Face ID when presented with permission dialog, I’m getting biometryNotAvailable error on calling canEvaluatePolicy(_:error:).
As per apple’s docs, we should get it when device doesn’t supports biometry. Im testing it on iPhone 12 Pro, Xcode 14, iOS 16 using deviceOwnerAuthenticationWithBiometrics policy. Below is the code Im using:

var canEvaluatePolicy: Bool {
    var error: NSError?
    guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
        print("\(error?.localizedDescription)") // Prints "Biometry is not available."
        return false
    }
    return true
}

Shouldn’t I get biometryNotEnrolled in this case? Any help is greatly appreciated.

[ad_2]