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
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()
}
This could result from not setting the correct deployment info. (i.e. if your storyboard isn't set as the main interface)
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.
Surprisingly, what worked for me was going to iOS Simulator menu, and pressing "Reset Content and Settings". (in iOS 13, its under Hardware)
you could also go to Hardware -> reboot, then Hardware -> Home, and click on your App
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