- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在将 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/
我正在将 TouchID 集成到我的应用程序中。出于安全原因,我允许用户打开和关闭它。我希望它在用户添加新指纹时自动关闭。根据 Apple,evaluatedPolicyDomainState Thi
我是一名优秀的程序员,十分优秀!