gpt4 book ai didi

ios - TouchID - 检测添加的新指纹 - evaluatedPolicyDomainState 何时更改?

转载 作者:搜寻专家 更新时间:2023-11-01 05:45:52 25 4
gpt4 key购买 nike

我正在将 TouchID 集成到我的应用程序中。出于安全原因,我允许用户打开和关闭它。我希望它在用户添加新指纹时自动关闭。根据 Apple,evaluatedPolicyDomainState

This property returns a value only when the canEvaluatePolicy(:error:) method succeeds for a biometric policy or the evaluatePolicy(:localizedReason:reply:) method is called and a successful Touch ID authentication is performed. Otherwise, nil is returned.

The returned data is an opaque structure. It can be used to compare with other values returned by this property to determine whether the database of authorized fingerprints has been updated. However, the nature of the change cannot be determined from this data.

但是,我正在添加一个新的指纹并且 evaluatedPolicyDomainState 保持不变。

关于如何确保 evaluatedPolicyDomainState 得到更新,或者是否有任何其他方法来检查是否添加了新指纹,我有什么想法吗?

最佳答案

经过几个小时的努力,我终于找到了解决方案。

    let context = LAContext()
context.canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil)

if let domainState = context.evaluatedPolicyDomainState
where domainState == oldDomainState {
// Enrollment state the same

} else {
// Enrollment state changed

}

每次添加或删除指纹时,域状态都会发生变化。您需要调用 canEvaluatePolicy 来更新 evaluatedPolicyDomainState

关于ios - TouchID - 检测添加的新指纹 - evaluatedPolicyDomainState 何时更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38397477/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com