我有以下的本地认证实现,正如许多地方所描述的。
context.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, localizedReason: "Logging in with Touch ID", reply: { (success : Bool, error : NSError? ) -> Void in
dispatch_async(dispatch_get_main_queue(), {
if success {
let alert = UIAlertController(title: "Success", message: "", cancelButtonTitle: "Great!")
self.presentViewController(alert, animated: true, completion: nil)
}
if let error = error {
var message :String
switch(error.code) {
case LAError..AuthenticationFailed:
message = "There was a problem verifying your identity."
case LAError..UserCancel:
message = "You pressed cancel."
case LAError..UserFallback:
message = "You pressed password."
default:
message = "Touch ID may not be configured"
}
let alert = UIAlertController(title: "Error", message: message, cancelButtonTitle: "Darn!")
self.presentViewController(alert, animated: true, completion: nil)
}
})
})
但是在我使用指纹成功进行身份验证后,然后调用 evaluatePolicy(,localizedReason:,reply:) 函数会直接返回成功而不要求任何指纹验证。
我实际上是通过 UISwitch 启用或禁用 TouchID,所以在禁用和重新启用后,我想重新进行身份验证并再次输入我的指纹。
为什么它会缓存认证?
谢谢