Добрый вечер, народ
Кто работал с биометрией, помогите.
При первом использовании Face ID выскакивает это окно. Как до него достучаться, где отлавливать события которые оно делает, да и что собственно вообще оно делает?
Мне просто нужно сохранять разрешил или нет юзер использование биометрии, а это видать происходит в этом окне.
laContext.evaluatePolicy(biometricsPolicy, localizedReason: localizedReason, reply: { (isSuccess, error) in
if let laError = error {
// handle error
self.showLAError(laError: laError)
} else if isSuccess {
// handle success
}
})
// function to detect an error type
func showLAError(laError: Error) -> Void {
var message = ""
switch laError {
case LAError.appCancel:
message = "Authentication was cancelled by application"
case LAError.authenticationFailed:
message = "The user failed to provide valid credentials"
case LAError.invalidContext:
message = "The context is invalid"
case LAError.passcodeNotSet:
message = "Passcode is not set on the device"
case LAError.systemCancel:
message = "Authentication was cancelled by the system"
case LAError.touchIDLockout:
message = "Too many failed attempts."
case LAError.touchIDNotAvailable:
message = "TouchID is not available on the device"
case LAError.userCancel:
message = "The user did cancel"
case LAError.userFallback:
message = "The user chose to use the fallback"
default:
if #available(iOS 11.0, *) {
switch laError {
case LAError.biometryNotAvailable:
message = "Biometry is not available"
case LAError.biometryNotEnrolled:
message = "Authentication could not start, because biometry has no enrolled identities"
case LAError.biometryLockout:
message = "Biometry is locked. Use passcode."
default:
message = "Did not find error code on LAError object"
}
}
message = "Did not find error code on LAError object"
}
//return message
print("LAError message - \(message)")
}