是否可以在之后以编程方式取消 TouchID 警报对话框LAContext.evaluatePolicy
称呼?如果是:怎么办?
并非 Apple 发布的每个 API 都会进入developer.apple.com(或 Xcode 的文档查看器)上的文档。 API 差异列出了公共 API,因此您看到的任何内容都在头文件中(请参阅LocalAuthentication/LAContext.h
)以及从这些标头生成的 Swift 接口。标头中的任何内容都是公共 API,因此您可以随意调用它。
有时(但并非总是)未记录的 API 有不错的标题注释,解释如何使用它们......值得庆幸的是LAContext.invalidate()
是其中之一:
/// Invalidates the context.
///
/// @discussion The context is invalidated automatically when it is (auto)released. This method
/// allows invalidating it manually while it is still in scope.
///
/// Invalidation terminates any existing policy evaluation and the respective call will
/// fail with LAErrorAppCancel. After the context has been invalidated, it can not be
/// used for policy evaluation and an attempt to do so will fail with LAErrorInvalidContext.
///
/// Invalidating a context that has been already invalidated has no effect.
@available(iOS 9.0, *)
public func invalidate()
确实,看起来像打电话invalidate()
当 Touch ID 警报可见时,应将其关闭。 (我自己没试过。)
iOS 11 更新:请注意,在配备 Face ID 而不是 Touch ID 的设备上,呼叫时会出现类似警报/HUD 的 UILAContext.evaluatePolicy
不需要或允许交互,并在成功验证后自行解散。理论上,invalidate
呼叫仍然会忽略它(或者如果面容 ID 无法识别用户,则会出现后续的实际交互式警报)。
但假设在所有可能的设备和身份验证方法上您总是有足够的时间来取消可能并不明智LAContext
要求后进行身份验证。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)