Application windows are expected


I get the runtime log message:

In looking at the code, we do instantiate a UINavigationController with a root view controller in application:didFinishLaunchingWithOptions:

[code]- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

RootViewController *rvc = [[RootViewController alloc] initWithNibName:nil bundle:nil];
navController = [[UINavigationController alloc] initWithRootViewController:rvc];

[self setWindow:[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]];
[[self window] addSubview:[navController view]];
[[self window] makeKeyAndVisible];

return YES;

So, what is going on? Thanks for the help.


UIWindow object has a rootViewController property, which you can set.


Thank you.


Can be set how?

I tried adding this line before the return in didFinishLaunchingWithOptions:

[[self window] rootViewController];

The compiler seemed happy with that, but I still get the line:
2013-07-07 19:01:39.196 iTahDoodle[941:11303] Application windows are expected to have a root view controller at the end of application launch

(Edit: Sorry, I did a search on root view controller, didn’t realize I strayed off the Objective C forum. I realize now I need to use “setRootViewController”, but my example is a bit different than this example and doesn’t seem to have a root view controller)