I'm trying to implement Touch ID login, but when user fails more than maximum attempts, I receive this error "Error Domain=com.apple.LocalAuthentication Code=-8 "Biometry is locked out." UserInfo={NSLocalizedDescription=Biometry is locked out.}"
I want to know:
Thanks!
You can unlock the biometry by authenticating the user using passcode. Just paste this function in your project and call this function before authenticating user using Touch ID.
If it returns true run Touch ID authentication and if it fails due to biometry lock out than it will ask user to enter iPhone passcode to unlock biometry. This will happen within the app.
func isBiometryReady() -> Bool
{
let context : LAContext = LAContext();
var error : NSError?
context.localizedFallbackTitle = ""
context.localizedCancelTitle = "Enter Using Passcode"
if (context.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: &error))
{
return true
}
if error?.code == -8
{
let reason:String = "TouchID has been locked out due to few fail attemp. Enter iPhone passcode to enable touchID.";
context.evaluatePolicy(LAPolicy.deviceOwnerAuthentication,
localizedReason: reason,
reply: { (success, error) in
return false
})
return true
}
return false
}
Touch ID, once locked-out due to incorrect tries, will be locked until the user enters the passcode. So there is no set time. The only way to unlock will be the passcode from this point onwards and there is no way to force an unlock, for obvious reasons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With