My app sends a request at startup and displays a brief message to users when it succeeds, by means of MTStatusBarOverlay
. Unfortunately, my current implementation seems to run afoul of iOS 9's view life cycle paradigms. I get the message
Application windows are expected to have a root view controller at the end of application launch
and the app crashes. The app works fine on iOS 7 & 8.
From searching around online, it seems like this might occur when trying to add the message view to the view hierarchy before the root view controller is established for the app's UIWindow
, but that doesn't seem to be the case here, see below.
Here is an excerpt of the UIApplicationDelegate
implementation:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[...]
self.window.rootViewController = [[MyViewController alloc] init];
[...]
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[MyDataManager sendRequestWithCompletion:^{
// Displays a message with MTStatusBarOverlay
[self showSuccessOverlay];
}];
}
application:didFinishLaunchingWithOptions:
is called before applicationDidBecomeActive:
so it seems like there should never be an issue with rootViewController
being established.
Why is this happening? What's different about iOS 9 that's causing the app to break?