简体   繁体   中英

iOS App is creating two UIWindow

I was refactoring an existing project to move away from using .storyboards and removed the initial main interface in .plist, but for some reason the app is creating two instances of UIWindow.

UIWindows

I have no idea on why this is happening, and the result of this is when I do create my actual UIWindow and use makeKeyAndVisible() for a second I get a black screen until the actual rootViewController becomes visible, this happens because in that split of a seconds it shows the first UIWindow which color is nil . If someone has any idea on why this is happening I would appreciate a bunch ;)

EDIT 1:

AppDelegate.swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    window = UIWindow(frame: UIScreen.main.bounds)
    appCoordinator.start()

    return true
}

AppCoordinator.swift

func start() {
        let mainVC = UIStoryboard(storyboard: .main).instantiateInitialViewController()
    window.backgroundColor = .white
    window.rootViewController = mainVC
    window.makeKeyAndVisible()
}

Check that "Main Interface" is empty:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM