如何在成功登录后重置 touchIDLockout?

How can I reset touchIDLockout after successful login?

我已经在 iOS 应用程序上成功实现了 Touch ID。但是,当用户尝试 Touch ID 失败次数过多时,我正在尝试处理错误情况。

我可以让用户关闭 Touch ID 对话框并通过 username/password 文本输入登录,但是在退出并再次尝试使用 Touch ID 时,localAuthContext.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: &authError) returns false 错误:LAError.touchIDLockout.

在用户使用他们的用户名和密码成功登录后,我可以使用一些function/boolean重置锁定吗?

锁定似乎是由 OS 强制执行的。这可能是为了防止用户空间应用规避安全策略(无论是否恶意)。

来自 Apple's iOS Security Guide(第 7 页):

...The passcode can always be used instead of Touch ID, and it’s still required under the following circumstances:

• The device has just been turned on or restarted.

• The device hasn’t been unlocked for more than 48 hours.

• The passcode hasn’t been used to unlock the device in the last 156 hours (six and a half days) and Touch ID has not unlocked the device in the last 4 hours.

• The device has received a remote lock command.

After five unsuccessful attempts to match a fingerprint.

• When setting up or enrolling new fingers with Touch ID.

粗体格式是我的。

Touch ID 似乎是为您的应用程序提供的一种方便的身份验证替代方法。由于您有一个后备方法来验证您的用户,也许您可​​以在有五次不成功的 Touch ID 尝试之前使用它(当然如果 Touch ID 不可用)。

编辑:

我在 LAError.h 文件中找到了一些文档,其中提供了 touchIDLockout 含义的一些上下文。它没有明确说明有多少次尝试导致锁定,但它确实说明现在需要密码。这与 Apple iOS 安全指南中的上述信息一致。

根据这个面向开发者的信息,我可以得出结论,重置由多次不成功的 Touch ID 尝试导致的锁定是开发者无法完成的事情。

希望这些附加信息对您有所帮助。