【发布时间】:2018-02-13 15:02:29
【问题描述】:
目前,我有以下代码。
if localAuthenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
localAuthenticationContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reasonString) { success, evaluateError in
if success {
self.performSegue(withIdentifier: "settingChange", sender: self) //TODO: User authenticated successfully, take appropriate action
如果触摸 id 被正确验证,代码执行到另一个视图控制器,但是当我尝试代码时,我得到这个错误:
我在不使用 TouchID 的情况下尝试了代码,它工作正常,但我不知道为什么它在使用 TouchID 时会产生错误。有人可以帮忙吗?
【问题讨论】:
-
控制台中有错误信息吗?像主线程的东西?因为
performSegue()和UI相关,必须在主线程中完成。另外,上面写着evaluatePolicy()状态:A closure that is executed when policy evaluation finishes. This is evaluated on a private queue internal to the framework in an unspecified threading context.
标签: ios swift localauthentication