Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 11 Simulator not allowing LAContext and FaceID

I've running the latest Xcode 9 GM (13 Sep 2017) and have set Hardware > Face ID > Enrolled in simulator as well as Deployment Target 11.0. However I'm getting error code -6 LAErrorTouchIDNotAvailable.

Is there some setting I'm missing?

let myContext = LAContext()
let myLocalizedReasonString = "You are pretty"

var authError: NSError?
if #available(iOS 8.0, macOS 10.12.1, *) {
    if myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
        myContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: myLocalizedReasonString) { success, evaluateError in
            if success {

                print("// User authenticated successfully, take appropriate action")
            } else {
                 print(" // User did not authenticate successfully, look at error and take appropriate action")
            }
        }
    } else {
         print(" // Could not evaluate policy; look at authError and present an appropriate message to user")
    }
} else {
     print(" // Fallback on earlier versions")
}
like image 591
user3774630 Avatar asked Sep 13 '17 03:09

user3774630


2 Answers

Face ID does not work in the Xcode 9 GM due to a framework bug. Xcode 9.1 fixes this issue.

You can test your app in the iPhone 8 simulator and ensure it works correctly with Touch ID or run the Xcode 9.1 beta and test Face ID support there.

like image 180
russbishop Avatar answered Oct 02 '22 11:10

russbishop


I think the iphone X simulator's faceID doesn't work at the moment, hopefully they will fix it soon...

https://forums.developer.apple.com/thread/86779

we could do a bug report to see if it speed things along :P https://developer.apple.com/bug-reporting

like image 44
adrian chen Avatar answered Oct 02 '22 11:10

adrian chen