My Swift app crashes when I have about 4 view controllers on my navigation stack and then at the 4th I call popToRootViewController
. It pops, so I know the UINavigationController
exists, but the app crashes without any error other than Exc Bad Access
. It also crashes when I dismiss the UINavigationController
instead of popping to root view controller.
Note: This happens only when running app on my test device. When my it's ran while my test device is connected to Xcode, it never crashes.
This is the only code in my final view controller, other than viewDidLoad
of course.
Code:
@IBAction func closeBtnPressed(sender: AnyObject) {
//dismissViewControllerAnimated(true, completion: nil)
self.navigationController?.popToRootViewControllerAnimated(true)
}
Any ideas? Thanks!