iOS 11模拟器不允许LAContext和FaceID

我运行了最新的 Xcode 9 GM(2017年9月13日)并设置了硬件>面部ID>注册了模拟器以及部署目标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")
}

解决方法

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

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

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...