【发布时间】:2020-09-29 17:00:19
【问题描述】:
我的应用可以使用生物认证,而ios应用只尝试了2次人脸id生物识别,问题是,我需要尝试3次才能添加输入密码的选项,我该怎么做那个?
这是我用于访问生物认证的代码
func loginWithBiometrics() {
let context = LAContext()
var error: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
let reason = "Identify yourself!"
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) { [weak self] success, authenticationError in
DispatchQueue.main.async {
if success {
print("success")
} else {
print("Failed biometric!")
}
}
}
} else {
print("Biometric not available!")
}
}
它只尝试2次face id,然后在2次face id错误后建议它输入密码。
我的期望是让用户尝试面部 id 3 次而不是 2 次。
【问题讨论】:
标签: swift authentication biometrics face-id