0
votes

I have a project that uses nib files, no storyboards. Depending on the app settings I need to display a different screen than what is being displayed now when the app is launched. I created this view as a storyboard in Interface Builder. In the main view controller's viewWilllAppear methodwhen certain conditions are true, I am trying to load the new storyboard and view controller:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"IncompleteSettings.storyboard" bundle: [NSBundle bundleWithIdentifier:@"Convention"]];
IncompleteSetingsViewController *vc = [storyboard instantiateInitialViewController];

I have tried passing nil and [NSBundle mainBundle] to the bundle argument.

I get this error:

08-09 11:38:39.188 Convention[17091:11603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'IncompleteSettings.storyboard' in bundle NSBundle (loaded)'

Project Details:

enter image description here

enter image description here

enter image description here

1
In your question, you say your project uses nibs and no storyboards. Why are you trying to create a storyboard then?Hetal Vora
Since storyboards are the new way to go, so I decided to use storyboards.septerr
If you are using Storyboards you should transfer your nibs to the storyboard and link them using segues.Robotic Cat
It is legacy code and I do not want to change too much about it at the moment. But I need to add this view and present it conditionally at launch time instead of the default launch view. Is it possible to do so?septerr

1 Answers

1
votes

You shouldn't add the extension in the name of the storyboard:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"IncompleteSettings" bundle:nil];