gpt4 book ai didi

ios - 如何在识别出 faceId 后导航到另一个页面?

转载 作者:行者123 更新时间:2023-11-28 13:38:41 26 4
gpt4 key购买 nike

当点击按钮时我添加了人脸识别和如果为真,需要导航到另一个页面。但没有工作。应用程序崩溃。几分钟后导航到下一页,后退按钮不起作用。

 @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")
}
}

错误信息是:

[Animation] +[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior.

最佳答案

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

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

关于ios - 如何在识别出 faceId 后导航到另一个页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56307020/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com