ios11biometricslacontextlocalauthenticationface-id

LABiometryType in iOS11 always return None


enter image description here

No matter what settings is configured in Device's passcode and touchId settings , LAContext always returns none . It is just throwing me a warning not the exception.

Its only working in XCode 9.1 Beta in iOS11.1 beta as suggested :(


Solution

  • I just figured out the problem! You have to call canEvaluatePolicy for biometryType to be properly set.

    Example:

    func isFaceIdSupported() -> Bool {
        if #available(iOS 11.0, *){
            if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) {
                return context.biometryType == LABiometryType.typeFaceID
            }
        }
    
        return false
    }
    

    As per the Apple docs for biometryType:

    "This property is only set when canEvaluatePolicy(_:error:) succeeds for a biometric policy. The default value is none."