1

I just started developing a game for my new iphone 5 but every time I build it to my device I get this warning in the console.

Application windows are expected to have a root view controller at the end of application launch

I searched the web for a fix but everything I was finding said to put this line of code:

window.rootViewController = rootViewController; 

In this method:

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

But the problem with this is that line of code had to be commented out in cocos2d because it was causing the application to start up in portrait mode no matter what orientation was selected. So does anyone know of a fix for this?

Stephen
  • 499
  • 9
  • 28

1 Answers1

1

This may not be relevant at all for solving your problem but I struggled with the same error a while ago when I began using iOS 6.0.

I was using the method - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation to do some initializations to my views at launch, but then I found out that it had been deprecated in iOS 6.0 (as mentioned here) resulting in the method never being called as before.

If that's your case you could simply implement the following:

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [self shouldAutorotateToInterfaceOrientation:toInterfaceOrientation]; }

Jonas Bromö
  • 138
  • 2
  • 6
  • My orientation is fixed now but instead of having the black letter box on the top and bottom of the screen on the iphone 5 it is the full 1/2 inch black bar on the bottom? – Stephen Sep 28 '12 at 22:50