rushisangani/BiometricAuthentication

An instance of LAContext can't determine biometryType until canEvaluatePolicy has been called

Chris-Corea opened this issue · 4 comments

It seems like your faceIDAvailable function will always fail because you don't call canEvaluatePolicy on the LAContext instance object before checking the biometry type.

Something like this should help:

public func faceIDAvailable() -> Bool {
        if #available(iOS 11.0, *) {
            let context = LAContext()
            return (context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) && LAContext().biometryType == .typeFaceID)
        }
        return false
    }

Here's the apple doc describing the biometryType instance property: https://developer.apple.com/documentation/localauthentication/lacontext/2867583-biometrytype

Thanks for reporting an issue, this has been fixed now.
Please update your pod to latest version BiometricAuthentication (1.0.1)

Very quick support! Thanks @rushisangani 💯

Nice component, am going to use it now ;-)

Issue fixed in version 1.0.1