2

Every new project I create in new XCode 5 using Single View or Master View templates are giving me error:

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

But error occurs only when objects such as UIView are added to classes. I do everything as always: initialize objects in .h file, create properties and synthesize in .m - but error does not go away.

Here is demo.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Vad
  • 3,658
  • 8
  • 46
  • 81

1 Answers1

3

Well and thats is not an error is just a warning... you have to add this code to your appdelegate didfinishlaunching

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor clearColor];
[self.window makeKeyAndVisible];
ViewController *cont = [[ViewController alloc]init];
[self.window setRootViewController:cont];

Where your view controller will be your rootview controller... if you are using storyboards, make sure the storyboards are added to your viewController correctly

Calleth 'Zion'
  • 613
  • 3
  • 15
  • That makes sense but it did not remove the warning and the view is fully black, no objects are visible on screen. Are you saying you tried these lines in my attached project and it worked? – Vad Oct 30 '13 at 00:50
  • i didn't try your code… but that warning comes when you haven't added a rootViewController… when you try your project does it shows your objects?? – Calleth 'Zion' Oct 30 '13 at 19:23
  • I just saw your code, it seems like you are starting other code before the lines i told you to use… so it goes first with the warning… – Calleth 'Zion' Oct 30 '13 at 19:33