Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App with Swift Views and View Controllers Designing Our App With Interface Builder

Austin Kladke
Austin Kladke
4,494 Points

Is there a workaround/fix to the iOS simulator showing only a black screen?

I've looked at the answers to other people's similar questions on here and have tried the solutions suggested, but none of them have worked so far. I've also looked at places like stackoverflow.com and have tried the solutions on there, but once again it didn't fix the problem. For clarification, after about 2 minutes of letting the iOS simulator just sit there, I get one of two error messages. It either says that the simulator lost connection with xcode or it says that an error occurred with the error number at the end.

Things I have tried:

  1. Restart computer and make sure computer is fully updated
  2. Reinstall xcode
  3. Consult the console (strangely, the iOS simulator is the only one with an empty log)
  4. Try random solutions posted on here and on other places on the internet

The only other thing that I can possibly think of doing is using an actual iPhone in place of the simulator. Unfortunately, I only have an iPhone 4. Is that not going to work? Any help is highly appreciated.

12 Answers

Stone Preston
Stone Preston
42,016 Points

on the simulator menu bar try resetting the content and settings (not sure if its in file or what, but its in the menu bar somewhere)

Stone Preston
Stone Preston
42,016 Points

it says that an error occurred with the error number at the end.

what does the message say exactly? is there an error message/code in the console?

I only have an iPhone 4. Is that not going to work?

if it has iOS 7 + on it it should work. you might have to change your deployment target to 7 in your project settings to get it to recognize it. you also have to be a member of the Apple Developer program which costs $99/yr

Austin Kladke
Austin Kladke
4,494 Points

It's either:

I. Lost connection to "iPhone 6" Restore the connection to "iPhone 6" and run " " again, or if " " is still running, you can attach to it by selecting Debug > Attach to Process > " "

or

II. An error was encountered while running (Domain = com.apple.CoreSimulator.SimError, Code = 146)

The console isn't actually saying anything (if I'm on the same page as you). It's what xcode is telling me after I've had the iOS simulator open for a couple of minutes.

Stone Preston
Stone Preston
42,016 Points

try deleting your derived data folder. see this stack overflow post for instructions on how to do that. then after you delete it. quit the simulator, quit Xcode, and restart your computer. then try running it again

Austin Kladke
Austin Kladke
4,494 Points

It's working (sort of). I took a screenshot but I don't know how to upload it here. Also, the screenshot looks different from the actual iOS simulator.

Stone Preston
Stone Preston
42,016 Points

upload the file to imgur.com and post a link to it

Austin Kladke
Austin Kladke
4,494 Points

http://imgur.com/86Gb5QO

On the left is the actual iOS simulator, the right one is the screenshot taken of the iOS simulator.

Stone Preston
Stone Preston
42,016 Points

you probably just need to change the zoom settings to something like 50%. i think thats in the window options of the simulator

Austin Kladke
Austin Kladke
4,494 Points

It worked! Thanks. And now I have an imgur account, that's an extra bonus haha. One more question: Is the problem solved now? Ie. why is it looking like it is now, shouldn't it be a white screen with the text that I created within the app

Stone Preston
Stone Preston
42,016 Points

Well the problem may not be solved yet.

the simulator works just like an actual iPhone. when you run the app, the simulator should start up the app and you should see the app. right now you just see the home screen of the iPhone (is the app running? if you just see the home screen then the app is not running) try running the app in xcode. it should open up automatically in the simulator

Austin Kladke
Austin Kladke
4,494 Points

http://imgur.com/D9Q6zsu

It worked! I clicked on the FunFacts app icon and it appeared after about 30 seconds (so it wasn't automatic, but hey it worked). Thanks, you've been super helpful. So am I in the clear now?

Stone Preston
Stone Preston
42,016 Points

yeah seems like it. if the app opened and ran its working as expected

Austin Kladke
Austin Kladke
4,494 Points

So it's working but: It takes like 5 minutes for everything to load and to finally get to the right screen and also I keep on getting the "Lost connection to iPhone" message. In xcode, it says that it has "Finished running FunFacts on iPhone 5s"

Does that actually constitute it as working...

Stone Preston
Stone Preston
42,016 Points

probably not. how old is your computer? what version of OS X are you running? what version of Xcode are you running?

Austin Kladke
Austin Kladke
4,494 Points
  • 2009 Macbook Pro (2.26 GHz Intel Core 2 Duo, 2 GB 1067 MHz DDR3)
  • OS 10.9.5
  • Xcode 6.1.1
Stone Preston
Stone Preston
42,016 Points

could be your computer I guess since its fairly old. seems like the simulator is just running super slow. do you have anything else running besides xcode and the sim?

the simulator seems to be working, it just takes forever to do anything.

Austin Kladke
Austin Kladke
4,494 Points

I have xcode, the simulator, and Safari with 2 tabs running.

Stone Preston
Stone Preston
42,016 Points

maybe try closing safari. its a shot in the dark but who knows

Austin Kladke
Austin Kladke
4,494 Points

So I have another computer next to me so I'm using the internet on this one instead. The only two things open on my MacBook are xcode and the simulator. So good news: everything loaded in twice as quickly. But I still got the "iPhone connection lost" message Also, a menu popped up that asked me if xcode wanted to help me debug the problem. So I put in my username and password and it did its thing but the "iphone connection lost" message still popped up.

Austin Kladke
Austin Kladke
4,494 Points

I was going to do that but it actually loaded in fully! I launched the simulator and the appropriate screen launched in about 5 seconds, very quickly. And Xcode says it's still running the app ("Running FunFacts on iPhone"). I've had it up for more than 5 minutes now and it still is saying that.

http://imgur.com/KdpjOoM I made an edit to it (put an ! at the end of the text) and it showed up, so looks like it's working. I'm still unclear why shutting down Safari could have fixed this but I'll take it haha.

Stone Preston
Stone Preston
42,016 Points

cool. glad its finally working