作者:千语千寻2012_501 | 来源:互联网 | 2023-01-15 17:33
![在此输入图像描述](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
无论在Device的密码和touchId设置中配置了什么设置,LAContext始终都不返回任何设置.它只是给我一个警告而不是例外.
它只能在iOS11.1测试版的XCode 9.1 Beta中工作:
1> Ermish..:
我刚刚发现了问题!你必须调用canEvaluatePolicy
为biometryType
要正确设置.
例:
func isFaceIdSupported() -> Bool {
if #available(iOS 11.0, *){
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) {
return context.biometryType == LABiometryType.typeFaceID
}
}
return false
}
根据Apple docs for biometryType:
"此属性仅在canEvaluatePolicy(_:error :)成功生成生物识别策略时设置.默认值为none."