Reputation: 1410
When running a program in XCode I received the following error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/user/Library/Developer/CoreSimulator/Devices/646F9805-AC4E-40A8-BC62-75B92339DCDC/data/Containers/Bundle/Application/D6C27367-F61B-4CAC-BB9E-1D48227CE629/WhatsNap.app> (loaded)' with name 'DisplayWarningViewController''
I am running the following lines of code and it gets an exception at the last line. I'm not sure as to why it happens. Other answers on this subject on SO indicate that the nib file might not be connected?
DisplayWarningViewController* DWVC = [[DisplayWarningViewController alloc]initWithNibName:@"DisplayWarningViewController" bundle:nil];
DWVC.delegate = self;
[self presentViewController:DWVC animated:NO completion:nil];
Upvotes: 1
Views: 594
Reputation: 994
Looks like you have view controller defined in storyboard! In that case you should do
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
DisplayWarningViewController *displayWarningVC = (DisplayWarningViewController *)[storyboard instantiateViewControllerWithIdentifier:@"DisplayWarningViewController"]
Upvotes: 1