In my application, I attempt to login with Face ID using evaluatePolicy
, and after 1 or 2 logins, I get an error in the callback. In that error, I call an async completion handler which calls another and eventually it calls canEvaluatePolicy
. My app then freezes, allowing no further interaction with the UI. Why would this be happening? Does it have something to do with thread-safety? Some sample code that recreates this issue, can be found here
Here is a code snippet from that sample code for reference:
let localAuthenticationContext = LAContext()
if localAuthenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) {
localAuthenticationContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "To access secure data") { success, evaluateError in
if success {
print("Success")
} else {
print("Face ID Error")
let context = LAContext()
let status = context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
print("Status: \(status)")
}
}
}
I've been using Xcode 9.1 Beta 2 with the iPhone X simulator.