ios - 当 TouchID 在 iOS 9 上被锁定时,LAContext.canEvaluatePolicy 返回 true
<p><p>我在 iOS 9 和 iOS 10 上使用 LocalAuthentication。并注意到以下行为差异。在 iOS 9 中,如果我执行下面显示的代码,并通过使用错误的手指进行身份验证导致 touchID 被锁定,即使在 Touch ID 被锁定后,调用 context.canEvaluatePolicy 也会返回 true,然后调用 context .evaluatePolicy 使设备提示我输入设备密码。</p>
<p>在 iOS 10 中,如果我锁定 TouchID,canEvaluatePolicy 会返回 false,错误是有一个指示 TouchIDLockout 的代码。</p>
<p>TouchIDLockout 是在 iOS 9 中引入的,所以我希望在 iOS 9 中获得该错误代码,但目前还没有。有其他人经历过吗?</p>
<pre><code>@IBAction func test(_ sender : UIButton) {
let context = LAContext()
var error : NSError? = nil
ifcontext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Boom", reply: { (success, error) in
let code = (error as? LAError)?.code.rawValue
sender.setTitle(String(code ?? 2), for: .normal)
})
}
}
}
</code></pre>
<p>}</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>在 Apple Dev Forums 中查找,这是 iOS 9 中的错误,已在 iOS 10 中修复。</p>
<p> <a href="https://forums.developer.apple.com/message/193538#193538" rel="noreferrer noopener nofollow">https://forums.developer.apple.com/message/193538#193538</a> </p></p>
<p style="font-size: 20px;">关于ios - 当 TouchID 在 iOS 9 上被锁定时,LAContext.canEvaluatePolicy 返回 true,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/42016670/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/42016670/
</a>
</p>
页:
[1]