![](/img/trans.png)
[英]UIViewController.navigationController must be used from main thread only
[英]UIViewController.storyboard must be used from main thread only - New Error I don't know how to fix?
确认用户身份验证后,而不是像我告诉它的那样转换到家庭 storyboard 不断崩溃,这是为什么,我该如何解决?
let confirmAction = UIAlertAction(title: "Pay", style: .default) { (action) in
do {
let context: LAContext = LAContext()
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) {
context.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Please confirm it's you") { (good, error) in
if good {
let homeViewController = self.storyboard?.instantiateViewController(identifier: Constants.Storyboard.homeViewController) as? HomeViewController
self.view.window?.rootViewController = homeViewController
self.view.window?.makeKeyAndVisible()
} else {
}
}
}
}
}
let cancelAction = UIAlertAction(title: "Cancel", style: .destructive, handler: nil)
let number = moneyTextField.text
D_AlertController.showAlert(style: .alert, title: "Confirm", message: "Pay Robyn
Saunders $\(number!)?", actions: [cancelAction, confirmAction], completion: nil)
把它包在里面
DispatchQueue.main.async {
let homeViewController = self.storyboard?.instantiateViewController(identifier: Constants.Storyboard.homeViewController) as? HomeViewController
self.view.window?.rootViewController = homeViewController
self.view.window?.makeKeyAndVisible()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.