phil_live
phil_live

Reputation: 1

error Storyboard doesn't contain a view controller with identifier

I'm getting the error :

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a view controller with identifier 'SBMenu''

On my AppDelegate, I check if the user is connected and launch :

I use xcode 6.1.1, sdk 8.1, deployment target 7.0
On emulator iOS 8.1, all is fine and I'm not getting the error.
On emulator iOS 7.0.3 or 7.1, I'm getting the error

the code :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

//...

if(self.token != nil){
    //crash
    self.viewController = (UIViewController *)[mainSB instantiateViewControllerWithIdentifier:@"SBMenu"];
}else{
    //don't crash
    self.viewController = (UIViewController *)[mainSB instantiateViewControllerWithIdentifier:@"SBLogin"];
}

self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
[self.window setRootViewController:self.viewController];
[self.window setBackgroundColor:[UIColor whiteColor]];
[self.window makeKeyAndVisible];

return YES;
}

I already checked tips found on other post :

Upvotes: 0

Views: 2688

Answers (2)

user2037296
user2037296

Reputation: 421

I faced the same problem but with a UISplitViewController, after hours of search, I discovered that disabling the size classes, would solve this problem.

Upvotes: 0

user2277872
user2277872

Reputation: 2973

This will only work if you are using Storyboard(s).

What you need to do is go into your storyboard, and find the view controller that is your "SBMenu" class.

Open the side panel, and find this:

enter image description here

Look for the box that says Storyboard ID. Make sure that your SBMenu class has SBMenu inside that box, and also check for your SBLogin class as well.

I hope that helps!

Upvotes: 1

Related Questions