Salman
Salman

Reputation: 389

Launched iOS simulator from Xcode 11.3 and getting a black screen

I was using Xcode 10. Did not have enough space to update to latest Xcode. So downloaded it from Apple's website and removed the old Xcode. To make more space I deleted all the cache, unavailable simulators, derived data and unwanted stuffs following this. After that installed the new Xcode 11.3.

My app is build successfully. But the emulator is showing only black screen.

I tried

"Erase All Content and Settings"

and also

defaults write com.apple.CoreSimulator.IndigoFramebufferServices FramebufferRendererHint 3

But still emulator is the same.

Upvotes: 3

Views: 2109

Answers (1)

Bharath Raj Kumar
Bharath Raj Kumar

Reputation: 51

Switching from Xcode 10 to Xcode 11 enables the dark mode/Dynamic Colors on your project.

There are two possible scenarios for your problem,

  1. The Simulator may be on the dark mode and your first view controller background automatically changes to dark mode.
  2. The Simulator may be on Light mode, but you have set your first view controller to be in a dark colour

For the first scenario,

Go to Settings in Emulator -> scroll all the way down to Developer -> Switch off the dark appearance.

Developer Settings screen in emulator

If you want to avoid using the interface Styles/ Light mode or dark modes, add the following in your info.plist file if you're opening as XML,

<key>UIUserInterfaceStyle</key>
<string>Light</string>

if you're using the plist file,

use the key,

UIUserInterfaceStyle

and set the String value as Light.

If you think you're facing the second scenario,

Change the dynamic system background colour of your view to a hardcoded UIColor in Interface builder or your ViewDidLoad()

override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        yourView.backgroundColor = UIColor.white

    }

Upvotes: 1

Related Questions