How to debug "Windows were created before application initialzation completed."

Viewed 3677

My universal iOS app displays the message

[ApplicationLifecycle] Windows were created before application initialzation completed. This may result in incorrect visual appearance.

Right at the start of launch - before didFinishLaunchingWithOptions is reached. The app does not crash although there is an issue later where a screen is unexpectedly blank - not sure why. The app does not display this message on an iPhone. The iPad uses a splitviewcontroller (actually a custom one).

It is written in objective-C with a mainWindow.xib, as opposed to storyboard. Can anyway offer any suggestions as to how to determine what is causing this issue.

4 Answers

I was having the same problem, the error will show only on ipad size 10.5 or bigger, i don't know if this will help you, in my case was caused by the launchImage. To solved I changed in settings - target - general, in the field - Launch screen file - set it to = LaunchScreen, and then in I dragged an image view on LaunchScreen.storyboard and load a LaunchImage.png in the image field.

In addition to PabloT.'s answer:

In your target settings, look for General - App Icons and Launch Images and see if the Launch Screen File is blank. You should set it to your mainWindow.xib.

This will not only solve this issue, it will also help to adjust your app to bigger iPad screen sizes.

What worked for me: You have to keep a reference to UIWindow, because when returning from didFinishLaunching, the temporary UIWindow *window is lost. This means:

@interface AppDelegate ()
{
    UIWindow *myWindow;
}
@end

I stopped receiving this error when I deleted the Launch Screen.xib left over from my Swift conversion.

The original app was in Objective-C, which required the xib file. After completing conversion recently, I started receiving the subject error message.

I deleted the Launch Code.xib, cleaned everything, and rebuilt. I haven't received the error since.

Related