0

From an UIViewController embebed in a UITabBarController I perform a modal segue by

self.present(.....

being "self" my view controller inside my UITabBarController. The new ViewController shows perfectly, let's call it ViewController2 that it's presented by ViewController1 modally. If I try to dismiss ViewController2 it always crashes with an Unknown Exception. libc++abi.dylib: terminating with uncaught exception of type NSException. ViewController2 is embebed in a UINavigationController but this ViewController2 is the only one that crashes.

I've tried dismissing the presentingViewController, presentationController, presentedViewController and self.navigationController?.dismiss but nothing is working for me.

The architecture is: UITabBarController->ViewController1 -modally present- UINavigationController->ViewController2

This is my presenting code:

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)

And this my dismissal code:

@IBAction func dismissView(){

    dismiss(animated: true, completion: nil)
}
JoseMartinFit
  • 335
  • 4
  • 13

0 Answers0