Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My View Controller is not loading with error Terminating app due to uncaught exception 'NSInternalInconsistencyException #211

Open
syedqamara opened this issue Mar 21, 2016 · 2 comments

Comments

@syedqamara
Copy link

I have 2 VCs
1 is My Demo and the other is my sideVC in Stordyboard file with an embeded Navigation Controller to my DemoVC.
i just copy your demoBasicApp delegate code to load my view just like this.

//////////////////////// Code in AppDelegete

  • (ViewController *)startViewController {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    ViewController *vc =[[ViewController alloc]init];
    vc = [storyboard instantiateViewControllerWithIdentifier:@"start"];
    return vc;
    }

  • (UINavigationController *)navigationController {
    return [[UINavigationController alloc]
    initWithRootViewController:[self startViewController]];
    }

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

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

    SideViewController *sideViewController = [[SideViewController alloc]init];
    sideViewController = [storyboard instantiateViewControllerWithIdentifier:@"SideViewController"];
    MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController containerWithCenterViewController:[self startViewController] leftMenuViewController:sideViewController rightMenuViewController:nil];
    self.window.rootViewController = container;
    [self.window makeKeyAndVisible];

    // Override point for customization after application launch.
    return YES;
    }

But it gives an Error..
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/applezone/Library/Developer/CoreSimulator/Devices/BA1DB1A1-D29B-4287-A232-79598EB77E11/data/Containers/Bundle/Application/2A1CA986-E75B-41FF-99A5-DD3027325CCA/PropertyProject.app> (loaded)' with name 'UINavigationController-Rpb-xy-BRz' and directory 'Main.storyboardc''

@Spoonrad
Copy link

Hey,

You are not configuring it correctly for a Storyboard app. Look at the Storyboard demo. Here is my own code to help:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:[NSBundle mainBundle]];
MFSideMenuContainerViewController *container = (MFSideMenuContainerViewController *)self.window.rootViewController;
UINavigationController *tabBarController = [storyboard instantiateViewControllerWithIdentifier:@"TabBarViewController"];
UIViewController *rightSideMenuViewController = [storyboard instantiateViewControllerWithIdentifier:@"SideMenuViewController"];
[container setRightMenuViewController:rightSideMenuViewController];
[container setCenterViewController:tabBarController];

Also make sure the starting point in your app is the container, NOT your navigation controller.

Your startViewController and navigationController methods also seem pointless to me: just create the links in IB directly, that’s what it’s for. At the least, remove
ViewController *vc =[[ViewController alloc]init];
as vc = [storyboard instantiateViewControllerWithIdentifier:@"start »]; already creates an instance of your ViewController.

Le 21 mars 2016 à 02:52, syedqamara [email protected] a écrit :

I have 2 VCs
1 is My Demo and the other is my sideVC in Stordyboard file with an embeded Navigation Controller to my DemoVC.
i just copy your demoBasicApp delegate code to load my view just like this.

//////////////////////// Code in AppDelegete

(ViewController *)startViewController {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ViewController *vc =[[ViewController alloc]init];
vc = [storyboard instantiateViewControllerWithIdentifier:@"start"];
return vc;
}

(UINavigationController *)navigationController {
return [[UINavigationController alloc]
initWithRootViewController:[self startViewController]];
}

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

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

SideViewController *sideViewController = [[SideViewController alloc]init];
sideViewController = [storyboard instantiateViewControllerWithIdentifier:@"SideViewController"];
MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController containerWithCenterViewController:[self startViewController] leftMenuViewController:sideViewController rightMenuViewController:nil];
self.window.rootViewController = container;
[self.window makeKeyAndVisible];

// Override point for customization after application launch.
return YES;
}

But it gives an Error..
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'UINavigationController-Rpb-xy-BRz' and directory 'Main.storyboardc''


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub #211

@syedqamara
Copy link
Author

Sir it is giving this Error Now..
2016-03-21 07:33:44.705 PropertyProject[6052:686988] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/applezone/Library/Developer/CoreSimulator/Devices/BA1DB1A1-D29B-4287-A232-79598EB77E11/data/Containers/Bundle/Application/7349C316-160D-438D-B5F6-D11B2E62BC47/PropertyProject.app> (loaded)' with name 'UINavigationController-Rpb-xy-BRz' and directory 'Main.storyboardc''

I have configured my appdelegate.m file with this code now..

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
MFSideMenuContainerViewController *container = (MFSideMenuContainerViewController *)self.window.rootViewController;
UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"navigationController"];
UIViewController *leftSideMenuViewController = [storyboard instantiateViewControllerWithIdentifier:@"SideViewController"];

[container setLeftMenuViewController:leftSideMenuViewController];

[container setCenterViewController:navigationController];

Here is the screenshot of my StoryBoard File..
screen shot 2016-03-21 at 7 36 39 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants