Launch iOS simulator from Xcode and getting a black screen, followed by Xcode hanging and unable to stop tasks

后端 未结 26 2494
一整个雨季
一整个雨季 2020-11-29 05:16

I\'m having trouble running my basic iPhone application (while going through the Stanford iTunes CS193p lectures) in the iOS simulator.

I\'ve been searching for a wh

26条回答
  •  失恋的感觉
    2020-11-29 05:18

    If you're using SwiftUI

    If you're updating from a previous version of Xcode 11, there are some changes to the SceneDelegate willConnectTo session: options connectionOptions initialization:

    The main window is now initialized using UIWindow(windowScene: windowScene), where it use to be UIWindow(frame: UIScreen.main.bounds)

    On previous version:

        let window = UIWindow(frame: UIScreen.main.bounds)
        window.rootViewController = UIHostingController(rootView: ContentView())
        self.window = window
        window.makeKeyAndVisible()
    

    In new version:

        if let windowScene = scene as? UIWindowScene {
            let window = UIWindow(windowScene: windowScene)
            window.rootViewController = UIHostingController(rootView: ContentView())
            self.window = window
            window.makeKeyAndVisible()
        }
    

提交回复
热议问题