I deleted all my .xib files a while ago, and recently changed my identifier. Now its started giving me this error:
Terminating app due to uncaught
exception
‘NSInternalInconsistencyException’,
reason: ‘Could not load NIB in bundle:
‘NSBundle
(loaded)’ with name
‘MainWindow”
MainWindow was deleted a while ago, and removing MainWindow from deployment info means that I’m just given a black screen. This is the code i have in my app delegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[application setStatusBarStyle:UIStatusBarStyleBlackOpaque];
[window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
}
Am i missing something? I presume i should remove MainWindow but as i say, this is just giving me a black screen.
You are getting this error because the
NSMainNibFilevalue is set in yourInfo.plist. It tells the OS to open thatNIBfile at launch. Since you’re doing away withNIBs for some reason, you will have to fill in the holes that you’ve created by deleting theNIBfile.Info.plist.You have to make some changes in your
main.m. Usually theMainWindow.xibcontained the information about your application delegate but now you need to provide it. Find the line that readsint retVal = UIApplicationMain(argc, argv, nil, nil);and replace it withint retVal = UIApplicationMain(argc, argv, nil, @"yourDelegateClassName");What you’ve done so far will instantiate the application delegate and your
application:didFinishLaunchingWithOptions:will get called but yourwindowisn’t set yet as it was taken care of by theNIBfile again. This will apply to all your outlets. Not only your `window.You will have to make some additions to your
application:didFinishLaunchingWithOptions:method like this,The above method is just a template and must be modified to your requirement.