Simulator only ever shows a blank screen

I am new to Xcode, so it may be something basic, but when I run the simulator it only shows a blank screen. I can change the colour of that screen by changing the background colour for the view in main.storyboard, but any labels or other views that I add do not show up, The videos end examples I see suggest that I should at least see the battery at the top of the screen, but I don't get that either.

I have added print in the viewDidLoad function which executes. I have deployed to a real device (it works), but no matter what I do with labels, buttons or text fields they do not show up. I have tried following step by step the Apple "jump in" coffee example (although it is Swift 2, and Xcode 7 I think it should approximately work). I have also followed a youtube click specifically for Xcode 8 and Swift 3 with the same result.

Things I have tried (from the suggestions on various forums):

  • IOS 10.1 and 9.3 (after installing 9.3)
  • different devices
  • Reset content on simulator
  • uninstall and reinstall Xcode - deleting the Devices from the file system Libary/Developer/CoreSimulator/Devices in between
  • check /etc/hosts has no spurious entries
  • wait for a long time
  • add constraints and not add constraints to the view
  • try it on another Mac
  • explicitly set "Main Interface" to be Main.storyboard - although it resets it to read just "Main"


There are no build time or runtime issues reported.


The fact that nobody else has had this problem suggests that I am doing something stupid, so to be clear, I followed the following steps:

Create new project.

On Main.storyboard, select view. Change background colour to green

Drag a label onto the screen. Drag until it meets the blue line on the left. Expand it until it reaches the line on the right. Change the text to "my label".

Run the simulator - iphone7 10.1 (for example)


Nice blank green screen :-(

Answered by Grebble in 194453022

ok. That might explain something. The fact that I saw the copyright helped. I now realise that it is a combination of two problems. It starts with the launchScreen storyboard and never leaves it (so never shows what I had put on the main storyboard).


The second problem is that the simulator is only showing the bottom half of the screen, so all the labels etc that I had carefully aligned at the top of the screen (I had tried adding them to the launchScreen as well) were never going to be shown.


That gives me two completely different problems to focus on, so I will mark this as answered. Why is this so difficult compared to Android?

I had another thought - I downloaded the first food tracker sample and opened it and upgraded to Swift 3. That gave a brief copyright Apple notice and then a white screen.

The food tracker sample has been reported as broken. Search here for past threads, etc.

Simulator only ever shows a blank screen
 
 
Q