0

When first play the app(In StoryboardA), app check the user's before data, and I want to change the screen according to the content. (StoryboardB, StoryboardC, ...)

So I check the user data from server and if user data exists,

let storyboard: UIStoryboard = UIStoryboard.init(name: "Category", bundle: nil)
let nextViewController = storyboard.instantiateInitialViewController()
self.navigationController?.pushViewController(nextViewController, animated: true)

But it occurs error.

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported'

How I can change the screen from StoryboardA to another Storyboard(StoryboardB, StoryboardC, ...) with navigationbar?

Polaris Nation
  • 1,085
  • 2
  • 18
  • 49
  • you either need to present a new navigation controller or set the rootViewController on the AppDelegate – Scriptable Jan 21 '19 at 08:54
  • 1
    Possible duplicate of [Pushing a navigation controller is not supported](https://stackoverflow.com/questions/17757072/pushing-a-navigation-controller-is-not-supported) – Shubham Jan 21 '19 at 08:54
  • The error it's absolutely right. You can not push a navigationViewController. you must push viewController instead – Enea Dume Jan 21 '19 at 08:59
  • @EneaDume In change another storyboard, I can't back before storyboard? – Polaris Nation Jan 21 '19 at 09:06

0 Answers0