12

My console posted this error today, [ApplicationLifecycle] UIWindows were created prior to initial application activation. This may result in incorrect visual appearance.

This has caused Application UI to not behave properly. I have never seen this before and need some insight on where to start debugging.

macOS: Catalina 10.15
XCode version: Version 11.1 
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Joshua
  • 481
  • 6
  • 21

1 Answers1

22

I think that apps main UIWindow should be lazily initiated. Try with this:

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    lazy var window: UIWindow? = UIWindow(frame: UIScreen.main.bounds)

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        window?.rootViewController = RootViewController() // root view controller
        window?.makeKeyAndVisible()

        return true
    }
}

Aron Balog
  • 574
  • 6
  • 9