识别faceId后如何导航到另一个页面?

时间:2019-05-25 17:11:05

标签: ios swift face-id

当单击按钮时,我添加了面部ID识别和if true,需要浏览另一个页面。但是没有用。应用程序崩溃了。几分钟后,导航到下一页,后退按钮不起作用。

 @IBAction func myProfile(_ sender: Any) {
    //    self.performSegue(withIdentifier: "MyProfile", sender: nil)
        let context:LAContext = LAContext()

        if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil){
            context.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Need to access with your finger print", reply: {(wasCorrect, error) in
                if wasCorrect{
                    print("correct")
                  self.performSegue(withIdentifier: "MyProfile", sender: nil)
                }else{
                print("incorrect")
                }
                })
        }else{
            print("finger print doesn't support touch id")
        }
    }

错误消息是:

  

[动画] + [UIView setAnimationsEnabled:]从   后台线程。从后台线程执行任何操作   不支持在UIView或子类上使用,可能会导致意外   和阴险的行为。

1 个答案:

答案 0 :(得分:0)

evaluatePolicy的回调在后台队列中运行

DisptachQueue.main.async {
  self.performSegue(withIdentifier: "MyProfile", sender: nil)
}