iOS: Getting this message (not an error) on console- Application windows are expected to have a root view controller at the end of application launch

When I Build my app, it compiles without any problems or errors. But when I run it I see this message in console:

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

Here is my Appdelegate's method which I believe might be causing this(based on other posts Ive seen on SO)

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

  self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  // Override point for customization after application launch.
  self.window.backgroundColor = [UIColor whiteColor];


  PhotosViewController *viewController = [[PhotosViewController alloc] initWithNibName:nil bundle:nil];

  self.navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
  [self.window addSubview:self.navigationController.view];

  [self.window makeKeyAndVisible];

   return YES;

Is this something that I need to be worried about? My app runs in the simulator even though this message shows up.

Any suggestions on what I should do to get rid of it? What can I do to debug this?

BTW, I have seen other questions on SO with the similar error message, however, none of the scenarios apply to mine so I have posted this question. Its not a duplicate :)

Thanks

Answers


Instead of:

[self.window addSubview:self.navigationController.view];

Use:

self.window.rootViewController = self.navigationController;

You can find more details in the UIWindow documentation


Need Your Help

How to handle popup authentication?

c# authentication web-scraping http-authentication

I'm fairly new to this, and don't have anyone else to ask. I'm attempting to access a webpage programmatically (C#) for some web-scrapping software. I've figured out the process of using the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.