iOS 11模拟器不允许LAContext和FaceID

use*_*630 6 ios ios-simulator ios11 iphone-x face-id

我已经运行了最新的Xcode 9 GM(2017年9月13日)并且已经设置Hardware > Face ID > Enrolled了模拟器以及Deployment Target 11.0.但是我收到错误代码-6 LAErrorTouchIDNotAvailable.

有什么设置我不见了?

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")
}
Run Code Online (Sandbox Code Playgroud)

rus*_*hop 8

由于框架错误,Face ID在Xcode 9 GM中不起作用.Xcode 9.1修复了这个问题.

您可以在iPhone 8模拟器中测试您的应用程序,并确保它与Touch ID一起正常运行或运行Xcode 9.1 beta并在那里测试Face ID支持.


adr*_*hen 5

我认为iphone X模拟器的faceID目前无法正常工作,希望他们能尽快解决它...

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

我们可以做一个错误报告,看看它是否能加快速度:P https://developer.apple.com/bug-reporting