Question or problem in the Swift programming language:
I’ve created a simple program where a person can log in with a username and password. Every time I attempt to run it, I simply get a blank white screen. I tried changing the background color to a dark green one in hope that it would change it in the simulator too, however I get the same white screen.
This problem arose before I got that breakpoint error, it first started happening randomly in a previous project, which makes me think something is wrong with my xcode.
See my screenshot below:
How to solve the problem:
I had this same issue where I saw the app briefly, and then it went to solid white. It pays to make sure you edit the “Main” storyboard, not the “LaunchScreen” storyboard when following tutorials…
Maybe my embarrassing mistake will help someone else…
There are a few things to keep in mind here that could be causing thsi error.
Firstly, as some of the comments have pointed out the first thing you should do is delete the breakpoints from all the lines. To do that, you have 3 choices:
- Press the blue arrow just above the console, that you can see here:This will disable all your breakpoints, so if you are using them intentionally somewhere else, don’t use this method.
- You can press each breakpoint individually, simply pressing the arrows next to your code on the left-hand side. This will disable the specific breakpoint. They then will become more greyish, like the one below
@IBAction func loginTapped()
- Last but not least, in my opinion the best method, simply grab the blue arrow and drag it to the right or left. This will make a cloud and zishing noise, symbolizing the deletion of the breakpoint.
Once this is out of the way, let’s take the second most important step. Check that the loginViewController is the initial View Controller, so that it’s the first page that’s displayed. To do that, simply open the file inspector on the right-hand side. You can activate it by pressing the third button here:
Then, select your viewController,, so that it light up’s blue like seen below:
Then, on the 3rd tab of The file inspector, by pressing the 4th tab that looks like an arrow pointing down. Now you should see a checkbox saying “isInitialViewController”. Tick that so that you get through immediately to this screen. It should look like this down below:
Lastly, I’d like to point you to some more things you should check that could cause this error:
- You never actually create the UITextField and UIButton
- You have a different view covering your viewController(eg, webView or view)
- You are on the wrong storyboard, this could happen but is unlikely.
If all this fails, try restarting Xcode, the simulator and running again by pressing the Play Sign or
Hope that helps, Julian
I don’t know who this might help but I solved my problem by reinstalling CocoaPods and installing everything with pod install and pod update. I reset my mac some time back because it’s storage was full and I forgot CocoaPods and all the pods uninstalled. Reinstalled them and now I’m back.
It didn’t fix it but I am getting closer.