【发布时间】:2018-09-07 09:09:45
【问题描述】:
我遇到了CoreAuthentication 的问题。
我已按照文档要求致电canEvaluatePolicy:error:,但结果始终为.none。
fileprivate let biometricsType: SecurityBiometrics = {
var error: NSError?
let evaluated = LAContext().canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: &error)
if #available(iOS 11.0, *) {
if LAContext().biometryType == .faceID { return .faceID }
if LAContext().biometryType == .touchID { return .touchID }
} else {
if (evaluated || (error?.code != LAError.touchIDNotAvailable.rawValue)) {
return .touchID
}
}
return .none
}()
// biometricsType returns `.none`
控制台上显示错误:
[LAClient] initWithExistingContext -> (null), 错误 Domain=NSCocoaErrorDomain Code=4099 "与服务的连接名为 com.apple.CoreAuthentication.daemon 从此失效 进程。" UserInfo={NSDebugDescription=与服务的连接名为 com.apple.CoreAuthentication.daemon 从此失效 过程。}
它以前已经工作过,但现在(没有任何更改)它仍然返回.none。
您是否遇到过同样的错误?
【问题讨论】:
-
How to test face-id - 这是完整的工作代码。您可以获取您的需求相关代码。
-
@Krunal
The connection to service named com.apple.CoreAuthentication.daemon was invalidated from this process.现在在控制台上显示两次,但现在可以正常工作了。谢谢!
标签: ios localauthentication core-authentication