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

后端 未结 26 2283
一整个雨季
一整个雨季 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()
        }
    
    0 讨论(0)
  • 2020-11-29 05:20

    This could result from not setting the correct deployment info. (i.e. if your storyboard isn't set as the main interface)

    0 讨论(0)
  • 2020-11-29 05:20

    Solution 1 : You can Quit simulator and try again.

    Solution 2 (Recommended) : Go to iOS Simulator -> Reset Content and Settings...

    This will pop-up an alert stating 'Are you sure you want to reset the iOS Simulator content and settings?'

    Select Reset if you wish to or else Don't Reset button.

    Note that once you reset simulator content all app installed on simulator will be deleted and it will reset to initial settings.

    0 讨论(0)
  • 2020-11-29 05:22

    Surprisingly, what worked for me was going to iOS Simulator menu, and pressing "Reset Content and Settings". (in iOS 13, its under Hardware)

    0 讨论(0)
  • 2020-11-29 05:24

    you could also go to Hardware -> reboot, then Hardware -> Home, and click on your App

    0 讨论(0)
  • 2020-11-29 05:26

    I had black simulator screens only for iOS 11 sims. After trying to reset, reboot, reinstall and creating a brand new useraccount on my machine I found this solution:

    defaults write com.apple.CoreSimulator.IndigoFramebufferServices FramebufferRendererHint 3
    

    found in this answer here: Xcode 9 iOS Simulator becoming black screen after installing Xcode 10 beta

    0 讨论(0)
提交回复
热议问题