将 Face ID 生物特征认证限制为 3
Make Face ID biometric authentication limit to 3
我的应用程序可以使用生物认证,而ios应用程序只尝试面部识别生物识别2次,问题是,我需要让它尝试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错误后提示输入密码
我的期望是让用户尝试面部识别码 3 次而不是 2 次。
根据 Apple 的说法,Touch ID 会尝试验证用户三次,但 Face ID 只会尝试验证用户两次。我只能假设这是因为 touch id 在某些情况下往往会经常失败,例如在温暖的国家,汗水会阻碍传感器验证指纹的能力。
Policy evaluation fails if Touch ID or Face ID is unavailable or not enrolled. Evaluation also fails after three failed Touch ID attempts. After two failed Face ID attempts, the system offers a fallback option, but stops trying to authenticate with Face ID.
我的应用程序可以使用生物认证,而ios应用程序只尝试面部识别生物识别2次,问题是,我需要让它尝试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错误后提示输入密码
我的期望是让用户尝试面部识别码 3 次而不是 2 次。
根据 Apple 的说法,Touch ID 会尝试验证用户三次,但 Face ID 只会尝试验证用户两次。我只能假设这是因为 touch id 在某些情况下往往会经常失败,例如在温暖的国家,汗水会阻碍传感器验证指纹的能力。
Policy evaluation fails if Touch ID or Face ID is unavailable or not enrolled. Evaluation also fails after three failed Touch ID attempts. After two failed Face ID attempts, the system offers a fallback option, but stops trying to authenticate with Face ID.