从嵌入在 UITabBarController 中的 UIViewController 我执行模态 segue
self.present(.....
在我的 UITabBarController 中成为“自我”我的视图控制器。新的 ViewController 完美展现,姑且称之为模态ViewController2呈现ViewController1。如果我尝试关闭ViewController2它,它总是会因未知异常而崩溃。libc++abi.dylib: terminating with uncaught exception of type NSException.
ViewController2嵌入在 aUINavigationController但这ViewController2是唯一一个崩溃的。
我试过解雇presentingViewController, presentationController,presentedViewController但self.navigationController?.dismiss没有什么对我有用。
架构是:UITabBarController->ViewController1 -modally present- UINavigationController->ViewController2
这是我的演示代码:
guard let vcDetail = UIStoryboard(name: "ProjectDetailStoryBoard\(currentDevice)", bundle: nil).instantiateViewController(withIdentifier: "vcDetailProject") as? ProjectDetailController else{return}
vcDetail.instantiatedFromPushNotification = true
vcDetail.projectId = key
let vc = UINavigationController(rootViewController: vcDetail)
UIApplication.topViewController()?.present(vc, animated: true, completion: nil)
这是我的解雇代码:
@IBAction func dismissView(){
dismiss(animated: true, completion: nil)
}