Launch iOS simulator from Xcode and getting a black screen, followed by Xcode hanging and unable to stop tasks
Surprisingly, what worked for me was going to iOS Simulator menu, and pressing "Reset Content and Settings". (in iOS 13, its under Hardware)
Before resetting the emulator first go to your projects "project navigator" screen and under the general -> depoyment info screen check that the main interface property is properly setup!
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()
}