1

I got the crash on Crashlytics of Fabric only for iOS 13 users when the NavigationBar of the particular ViewController is being hidden.

I tried by hiding the NavigationBar for particular ViewController by using NavigationController's delegate method

func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
    let hide = (viewController is MyVC)
    navigationController.setNavigationBarHidden(hide, animated: animated)
}

But it also generating the crash on crashlytics called

Fatal Exception: NSInternalInconsistencyException

threading violation: expected the main thread
Nikunj
  • 630
  • 1
  • 6
  • 20

3 Answers3

0

Hide it on main thread

Dispatch.main.async {
    navigationController.setNavigationBarHidden(hide, animated: animated)
}
Lu_
  • 2,577
  • 16
  • 24
0

Do you call navigationController.setNavigationBarHidden from a background Thread?

Try:

DispatchQueue.main.async { [weak self] in
     self?.navigationController?.setNavigationBarHidden(hide, animated: animated)
}
extrum
  • 11
  • 2
0

I got a solution for the above issue,

I used Xcode 10.2.1 to upload the build of the app, and I didn't get any crashes now.

Nikunj
  • 630
  • 1
  • 6
  • 20