I've a very strange situation here - call of the method UINAvigationController -> setViewControllers:animated:
causes a crash of the app. It's happining only on iOS 10.3.2 and when I'm building the app in release mode.
I've collected more details. Hope they can help to understand what happens.
The issue appears on iOS 10.3.2 and in release mode only. I’ve checked this on iPhone with 10.3.2 and release build fails but debug works OK. Additionally, I’ve checked previous version of the app from AppStore on iOS 10.3.2 and it’s OK too. Debug and release builds work fine on all of the previous versions of iOS.
The previous version in AppStore was built with older version of Xcode, and now I'm using latest Xcode 8.3.2. I suppose it's system issue, which is related to iOS and Xcode versions.
Regarding sources, it looks like:
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
...
window = UIWindow(frame: UIScreen.main.bounds)
....
let navigationController = UINavigationController(rootViewController: viewController)
window.rootViewController = navigationController
window.makeKeyAndVisible()
}
ViewController.swift
override func viewDidLoad() {
super.viewDidLoad()
...
continueButton.addTarget(self, action: #selector(navigateForward), for: .touchUpInside)
...
}
func navigateForward(sender: UIButton!) {
let nextController = FinalBuilder.viewController()
navigationController?.setViewControllers([nextController], animated: true)
}
I said before, it works fine in all cases except one :). UINAvigationController -> setViewControllers:animated:
is standard iOS method, available from iOS 3.0+ and not deprecated now. There are no hacks or something else what can corrupt the program flow. And it’s usual way to use it.
P.S. There is no debug log or any other message which I can provide you because the app just disappears from the screen with no notification at all.