Reputation: 12650
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!
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)
Upvotes: 5
Views: 11886
Reputation: 301
For me, it was that I was doofishly accessing variables that were not set in my ViewDidLoad. This new view was previously hooked up to a segue from another view, which had set the variables.
Upvotes: 0
Reputation: 7344
topViewController
is 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:
Move it via drag&drop to your safetyCultureMainVC
like this:
Upvotes: 7
Reputation: 4111
Your Initial View Controller needs to be embedded in something when you are in a storyboard. For example, tab bar controller, navigation controller...
Judging from your workflow you posted, all your controllers should be part of the same navigation controller. Starts with Safety Culture, then goes one of two paths depending on which button is pushed.
It should look like this:
Upvotes: 0