0

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.

comrade
  • 4,590
  • 5
  • 33
  • 48

2 Answers2

0

if its not work , so you can try easy way like

simple creat view controller object and pass in navigation

let nextVC = storyboard?.instantiateViewController(withIdentifier:"ScrollViewController") as! ScrollViewController
self.navigationController?.pushViewController(nextVC, animated: true)
a_tuo
  • 651
  • 7
  • 23
Berlin
  • 2,115
  • 2
  • 16
  • 28
0

I've found that this behavior appeared after update of RxCocoa from 3.3.1 to 3.4.0. It happens because of the following change in DelegateProxyType.swift : extension ObservableType : func subscribeProxyDataSource:

     return Disposables.create { [weak object] in
         subscription.dispose()
-       unregisterDelegate.dispose()
         object?.layoutIfNeeded()
+       unregisterDelegate.dispose()
     }

I've posted report to ReactiveX/RxSwift repository. You can check final state there, if you are interested.

comrade
  • 4,590
  • 5
  • 33
  • 48