LAContext.biometryType still returns LABiometryType.none in iOS 11 and 11.1 beta

I'm trying my best to support FaceID in my application, but as it is right now i cannot.


running LAContect().canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) returns true, so i expect that the device has biometrics enabled (which it has, it is a iPhone 7 with iOS 11.1 beta with touch id enrolled and working for unlock)

so when later checking LAContext.biometryType i of course expect to get LABiometryType.typeTouchID, but as the title says it returns LABiometryType.none


this is true for Xcode 9, and 9.1 beta, iOS 11 and 11.1 beta


is there any approved workaround or can we expect that it will be fixed once 9.1 and/or 11.1 are released respectively?


Thanks


Martin

Accepted Reply

You need to first call canEvaluatePolicy in order to get the biometry type. That is, if you're just doing LAContext().biometryType then you'll always get 'none' back. You would first need to call canEvaluatePolicy on that instance, and then biometryType should have a non-none value (assuming the device has biometry support, and the user has enabled it).

Replies

I'm also seeing this same issue.


Open Radar: https://openradar.appspot.com/34857036

Video of issue: https://youtu.be/5ls4KwMNjRU

Sample Project: https://github.com/jsambuo/TestBiometryType

Still valid in Xcode 9.1 beta 2, and iOS 11.1 beta 2 in swift 4

You need to first call canEvaluatePolicy in order to get the biometry type. That is, if you're just doing LAContext().biometryType then you'll always get 'none' back. You would first need to call canEvaluatePolicy on that instance, and then biometryType should have a non-none value (assuming the device has biometry support, and the user has enabled it).

Thank you very much! This makes it work for me.

let myContext = LAContext()
myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
switch myContext.biometryType {
case .none:
    print("None")
case .typeFaceID:
    print("FaceID")
case .typeTouchID:
    print("TouchID")
}

Thank you!


Edit: But how do i then know what type of biometrics is not working?


i run context.canEvaluatePolicy and get error will the biometry type still be set?

Yes, that seems to work.