when i compile my app, Xcode just says \"Attaching to Projectname...\" and gets stuck there. The debugger just prints this out:
error: failed to attac
If resetting content and settings in the Simulator doe snot work for you, make sure that there is an entry for localhost in your /etc/hosts file:
127.0.0.1 localhost
Some programs can delete the line or comment it out (#) or even delete your /etc/hosts/ file completely. I tried everything described, but once I added localhost back to the file, the simulator worked perfectly for me.
Lindemann's solution worked for me. Nonetheless, during further development I came across another situation that generates this problem: if you create a folder reference (blue folder on Xcode's file explorer, as opposed to the yellow ones which are just groups) called "Resources" the same issue will arise. The solution in this case is to simply rename that folder. After this, follow Lindemann's solution.
Ctrl-Shift-Option-K (same as holding down option and selecting Product ... Clean Build Folder) has always worked for me.
You need to change the debbugger LLDB to GDB. This helped me start my program in the simulator.
This happened to me when I had two xcode projects open with the same bundle identifier.
Solution: leave only one project open which has the same bundle id.
Have you tried closing down the simulator entirely, or failing that, reset the simulator and all its contents usually does the trick.