Xcode: Storyboard change initial view controller

11,826

topViewControlleris a method of a UINavigationController. You app tries to call this method and since it is not there it crashed.

In your image your entry point arrow is still on the navigation controller:

enter image description here

Move it via drag&drop to your safetyCultureMainVClike this: enter image description here

Share:
11,826
Kevin Brown
Author by

Kevin Brown

Currently working as a rails developer for [Fleetio] After obtaining a degree in Mechanical Engineering with an energy specialty. After that, I worked 1 year for Babcock & Wilcox in nuclear services; then moved to work for Honda for the next 4+. During that time, I spent every moment learning ruby/rails/js and now love what I do as a software engineer.

Updated on June 14, 2022

Comments

  • Kevin Brown
    Kevin Brown over 1 year

    I started my app with the "master-detail" template. I simply added two other VCs and changed the "initial view controller" checkbox to "Safety Culture MainVC"...when I run, my app crashes...

    What do I need to do?!

    This is a screenshot of the default storyboard with my two other VCs thrown in--they work when the "Navigation Controller" is the default.

    Clearly, I'm a beginner, so as much detail as you can give me is helpful!! Thanks!

    Storyboard

    Debug Output:

    2012-06-07 10:38:42.812 SafetyCulture[1020:fb03] -[safetyCultureMainVC topViewController]: unrecognized selector sent to instance 0x6b7c210 2012-06-07 10:38:42.840 SafetyCulture[1020:fb03] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[safetyCultureMainVC topViewController]: unrecognized selector sent to instance 0x6b7c210' * First throw call stack: (0x16ae022 0x183fcd6 0x16afcbd 0x1614ed0 0x1614cb2 0x2619 0x17386 0x18274 0x27183 0x27c38 0x1b634 0x1598ef5 0x1682195 0x15e6ff2 0x15e58da 0x15e4d84 0x15e4c9b 0x17c65 0x19626 0x22ed 0x2255) terminate called throwing an exception(lldb)