我的控制台今天发布了此错误,[ApplicationLifecycle] UIWindows were created prior to initial application activation. This may result in incorrect visual appearance.
这导致应用程序用户界面无法正常运行。我以前从未见过这种情况,因此需要对从哪里开始调试有一些了解。

macOS: Catalina 10.15
XCode version: Version 11.1

最佳答案

我认为应延迟启动应用程序的主要UIWindow。试试这个:

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
    }
}

关于ios - 如何: Debug UIWindows were created prior to initial application activation,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58772513/

10-11 20:22