I'm facing a problem with CoreAuthentication
.
I have called canEvaluatePolicy:error:
as the documentation ask for but the result is always .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`
A error is showing up on the console :
[LAClient] initWithExistingContext -> (null), Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.CoreAuthentication.daemon was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.CoreAuthentication.daemon was invalidated from this process.}
It already have worked before, but now (without any changes) it's still returning .none
.
Do you have run into the same error ?
You didn't share full error message. Here is full error message:
In normal language, it says you have a problem with
LAContext()
which is initialised every time ([LAClient] initWithExistingContext -> (null)
) in your code block. Use a single instance of LAContext.Try this and see:
Result: biometricsType - 2
Look at this snapshot: