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

George Hamilton
George Hamilton
2,777 Points

My Simulator is just showing black

When I try to run the simulator with my code it says it complies in xcode but the simulator just shows black. When I hit the stop button in xcode I get the error message : "An error was encountered while running (Domain = DTiPhoneSimulatorErrorDomain, Code = 2)" please help

4 Answers

George Hamilton
George Hamilton
2,777 Points

I FOUND THE SOLUTION steps 1-2 were just to download all the simulators in the preferences tab of xcode, here is what did the trick even though I have no idea why

3) I am facing same issue again next morning.

   Unsetting the DYLD_INSERT_LIBRARIES variable solves my problem:-

a) Open terminal and type "sudo vi /etc/launchd.conf" command and press Enter b) Press I "Insert" mode and change this

         "setenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib" 

                              to this 

          "unsetenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib" 

   and press esc to exit from insert mode. 

c) Save changes by typing ":wq" Press Enter
d) Reboot your system and problem soloved.

Actually if your system is a bit slow, this is normal, just wait a minute. On my side i have to wait between 30sec to 1min in order for screen to turn from black to my screen.

Hi George!

I was facing the same problem when I first started on the iOS course. The first thing I would recommend doing is opening it up and in the top bar under 'iOS Simulator' hit the reset content and settings button.

Once you have done that, if you haven't already since installing xCode, restart your computer.

If you are still having problems after carrying out these steps then reply back to me and I shall try and help you out further.

-Luke

George Hamilton
George Hamilton
2,777 Points

Hi Luke,

Thanks! I tried both of these things and neither worked; I also tried turning off my firewall. Next, I tried removing and re-adding all of the devices within simulator, but that didn't work either. Please let me know if you have any other ideas.

Thanks, George

Do you have any breakpoints in your code? Try making a brand new project and running it. If that works then the issue is probably in your project.

George Hamilton
George Hamilton
2,777 Points

Marshall,

Thanks for the suggestion. I tried creating a new project and unfortunately I'm still getting the same error message and it still says "unable to boot simulator". Please let me know if you have any other ideas.

Thanks, George

In this case I would delete Xcode from your system, reboot, and reinstall it.

George Hamilton
George Hamilton
2,777 Points

Marshall,

Unfortunately I tried this too and it didn't work either; I even tried using this thing called AppCleaner to get rid of all the related files. I think I'm just going to go to the apple store and see if they can help. Thanks anyways

-George

George Hamilton
George Hamilton
2,777 Points

Marshall,

Unfortunately I tried this too and it didn't work either; I even tried using this thing called AppCleaner to get rid of all the related files. I think I'm just going to go to the apple store and see if they can help. Thanks anyways

-George