Applications are expected to have a root view controller at the end of application launch
Solution 1:
Replace in AppDelegate
[window addSubview:[someController view]];
to
[self.window setRootViewController:someController];
Solution 2:
I had this same problem. Check your main.m. The last argument should be set to the name of the class that implements the UIApplicationDelegate protocol.
retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
Solution 3:
I had the same error when trying to change the first view controller that was loaded in
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
At first I didn't really know where the error was coming from precisely so I narrowed it down and found out what went wrong. It turns out that I was trying to change the display of a view before it actually came on screen. The solution was hence to move this code in the viewcontroller that was giving me trouble from
- (void)viewDidLoad
to
- (void)viewDidAppear:(BOOL)animated
and the error stopped appearing. My problem specifically was caused by making a UIAlertView
show.
In your case I suggest you check out the code in the tabBarController's active view controller (as it is probably a problem in that view controller). If that doesn't work, try to set the starting settings in the nib file instead of in code - or if you want to do it in code, try moving the code to the tabBarController's active viewcontroller's appropriate method.
Good luck!
Solution 4:
I got this when starting with the "Empty Application" template and then manually adding a XIB. I solved it by setting the main Nib name as suggested by Sunny. The missing step in this scenario is removing
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
from
application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
As it will overwrite the instance of your window created in the Xib file. This is assuming you have created a ViewController and wired it up with your window and App Delegate in the XIB file as well.
Solution 5:
This happened to me. Solved by editing .plist file. Specify the Main nib file base name.(Should be MainWindow.xib). Hope this will help.