【问题标题】:Make Face ID biometric authentication limit to 3将 Face ID 生物特征认证限制为 3
【发布时间】: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


    【解决方案1】:

    根据 Apple 的说法,Touch ID 会尝试验证 3 次,而 Face ID 只会尝试验证用户两次。我只能假设这是因为在某些情况下,比如温暖的国家,汗水会阻碍传感器验证指纹的能力,因此 touch id 往往会失败。

    如果 Touch ID 或 Face ID 不可用或未注册,则策略评估失败。在 3 次失败的 Touch ID 尝试后,评估也会失败。在两次失败的 Face ID 尝试后,系统会提供一个回退选项,但会停止尝试使用 Face ID 进行身份验证。

    资源:https://developer.apple.com/documentation/localauthentication/lapolicy/deviceownerauthenticationwithbiometrics

    【讨论】:

    猜你喜欢
    • 2020-04-19
    • 2021-11-16
    • 2016-02-18
    • 1970-01-01
    • 1970-01-01
    • 2021-03-23
    • 1970-01-01
    • 2015-12-21
    • 1970-01-01
    相关资源
    最近更新 更多