Reputation: 91
I am working on a table view application and I got this type of run time error:
Applications are expected to have a root view controller at the end of application launch
Any suggestion and sample codes are expected.
Upvotes: 1
Views: 3356
Reputation: 12890
Here is the standard implementation from a Single View Application. Note that a View Controller is allocated and initialised and then assigned to self.window.rootViewController
Your application would have had something like this but somehow you have lost/deleted the self.sindow.rootViewController assignment
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
Upvotes: 1
Reputation: 23722
The warning means that in your application delegate's application:didFinishLaunchingWithOptions:
method you should assign a view controller as the main window's rootViewController
:
self.window.rootViewController = myRootViewController;
Upvotes: 6