In my app, I set the window's rootViewController in willFinishLaunching
. Standard.
In didFinishLaunching
, I check to see if the user is logged in, and if not, I present a LoginViewController.
- (BOOL)application:(UIApplication *)application willFinishLaunching...
{
...
self.window.rootViewController = [MyViewController new];
[self.window makeKeyAndVisible];
...
return true;
}
- (BOOL)application:(UIApplication *)application didFinishLaunching...
{
if (/* not logged in */) {
UIViewController *login = [LoginViewController new];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:welcome];
[self.window.rootViewController presentViewController:nav animated:false completion:nil];
}
return true;
}
In iOS 7, this works perfectly. However, in iOS 8, I see the following warnings in my console:
Unbalanced calls to begin/end appearance transitions for <LoginViewController: 0x7fca9340cbb0>.
I'm not quite sure what I need to do to avoid this warning while still being able to present my LoginViewController.
I like presenting from window.rootViewController
because it allows me to dismiss LoginViewController
when the user logs in without having to add completion/callback code to any other view controllers in my application.
Any ideas?