I have been reading the forums and so far none of the solutions suggested works for me. I'm running Xcode 4.4.1 and testing in iPhone 5.1 simulator. The simulator won't open the apps anymore and I'm getting the above error. Any thoughts or solutions pls?
-
I gave this answer for the same problem. http://stackoverflow.com/a/13682769/187752 – Kimi Dec 03 '12 at 12:08
-
check my answer here http://stackoverflow.com/questions/12610090/xcode-4-5-doesnt-run-load-app-on-simulators-or-device/15384919#15384919 – Vaibhav Saran Mar 13 '13 at 12:36
-
This same question appears 3 times: [__one__](http://stackoverflow.com/questions/12741188/error-failed-to-attach-to-process-id-0) [__two__](http://stackoverflow.com/questions/9702201/xcode-compiles-my-app-but-cant-run-it-in-the-simulator) [__three__](http://stackoverflow.com/questions/11535844/failed-to-attach-to-process-id-xcode). There are tons of answers under each, so if this one didn't help you, check the other 2. – bobobobo Apr 21 '13 at 22:03
22 Answers
Go to IOS Simulator tool bar and click Reset Content and Settings...

- 2,622
- 7
- 29
- 45
-
This works but resetting the content is not always needed : usually I just uninstall the app and it works. – mbritto Nov 08 '12 at 14:29
-
9This problem occurred for me when I had two targets. Running one would wreck the other, causing me to constantly use the "Reset Content and Settings." The problem was fixed after a colleague changed the MyCFBundleID in the build settings, so that the two targets would have different names. It all works as it should without having to use the "Reset Content and Settings." feature. – Yogurt Nov 21 '12 at 00:57
-
1Thanks so much Scoota - I'd tried everything I could think of and was so close to giving up but this fixed my problem. – Stephen Watson Jan 19 '13 at 18:20
I've met the same problem
1.you can delete the App directy under
~/Library/Application Support/iPhone Simulator/6.0/Applications
and ~/Library/Developer/Xcode/DerivedData
2.then you can start Xcode ; in the menubar you can find Project -> Clean
EDIT: before copy/pasting 1 above change the Simulator Version to what you are using!

- 658
- 5
- 15

- 973
- 7
- 5
-
3
-
I've searched it over an hour now, and nothing worked. Until this one! :) Thanks a lot! – Grzegorz D. Jun 18 '13 at 16:41
Click on Simulator and reset the simulator by going to the “iOS Simulator” main menu and choose “Reset Content and Settings…
Back in XCode, choose the menu "Product" > "Edit Scheme". On the left menu panel, click on "Run _Your_Project_Name_.app" > "Run _Your_Project_Name.app". The info display on the right should have the "Debug Process As" radio button picked as "Me (your-user-name)". If not, make sure you do not login as root. On Stackoverflow there are many reports of running as root will have problems
Next, still in Xcode, go to the menu "Window" > "Organizer". On the top menu, click on "Projects". Go ahead and delete "Derived Data".
Finally, go to "~/Library/Application Support/iPhone Simulator/6.0/Applications" and delete everything that’s in there

- 1,288
- 12
- 22
Finally, I found out the problem was I had a folder called "resources" that I used to store all my images. When I changed the name of the folder to something less likely to be used by XCode somewhere else, I did the whole delete derived data/clean/restart XCode and it worked!

- 11,875
- 14
- 64
- 106
-
2You would think Apple would sort this out, "resources" is the most common folder name ever for devs to use. – Mirror318 Apr 17 '13 at 22:48
-
If I could up vote this a 1000 times, I would. That was my problem too! – Quentin Aug 15 '13 at 02:20
-
Me too. In my case, I had `Resources` with an initial cap. Literally unbelievable bug of Apple's. – Basil Bourque Aug 15 '13 at 11:14
Nothing from mentioned above helped me. But as I found that few moments before, I (or some other entity) had somehow removed records from my /etc/hosts file and I got the same error.
You should check whether you have in your /etc/hosts file the line "127.0.0.1 localhost". As this line is missing, the LLDB debugger is generating issues.
So just add 127.0.0.1 if you have it missing in your /etc/hosts.
This helped me!

- 12,762
- 3
- 58
- 74
Delete the app on the iOS simulator. It works for me.

- 1,490
- 1
- 13
- 17
-
I tried each of the other solutions but finally this was required to correct the issues. Thanks TK189! – CocoaEv May 13 '13 at 01:18
I guess there exists someone who is in case the matter happens only in a project, not in every project and failed to resolve the matter after doing a lot of solutions posted on this Question page, such as 'deleting the App directy under ~/Library/Application Support/iPhone Simulator/6.0/Applications and ~/Library/Developer/Xcode/DerivedData', 'Cleaning all the logs by doing Project -> Clean' and 'Cleaning all the log and contents in the iOS Simulator Menu' and anything else.
Yes, I also finally failed to resolve that.
For you, It might be a solution if you are in the problem I mentioned above: Create a new project with a similar name, and copy and paste all of your classes and resourse files existing in your previous project folder to the new one and link the references between your new project and the copied files in Xcode. Then, clean the build logs by pressing 'Shift + Command + K'.
In my case, this made me able to continue my work...

- 6,620
- 12
- 48
- 49

- 31
- 2
Cleaning (either deleting folders, or Product->Clean) did not worked.
I saw that in my .plist the bundle id had been removed. Thanks to git. I checkouted-- the file, and bam! deployed to simulator no problem.
Just sharing...

- 1,884
- 21
- 39
-
My problem was due to a missing Bundle Id too, thanks. I would rather thank Apple for not showing an alert "No Bundle Id set" ... – Sébastien Sep 09 '13 at 15:08
-
Sometimes this problem arises from having two targets in a project, both using the same bundle identifier but building products with distinct names.
Deleting the application on the device/simulator solves the problem, as it has been said earlier.

- 2,020
- 1
- 14
- 27
This happend to me after changing the Product name.
After resetting the simulator, cleaning the project, and restarting XCode, nothing worked. After shutting down and restarting the simulator everything worked as expected.

- 3,151
- 4
- 33
- 40
I had the same problem and I found that you can't be using the root account on your Mac. If you are logged in as root you are not able to attach process to the Simulator. You have to be logged in as a different account.

- 306
- 1
- 3
Every time I have this issue (that is quite often actualy), I uninstall the app from the simulator (like a user would on the device) and do a clean on XCode. Next build and run works.
I can also reset the simulator content and settings to make it work but this seems like using a bazooka to kill a fly.

- 898
- 12
- 25
This also happens if you prepare your file for enterprise distribution and end up saving the resulting .ipa and .plist in the project directory, thus overwriting your project plist. When that happens you'll know because the version information and main window in your project configuration will be blanked. If this happens restore your old plist from source control... and save your product files elsewhere !

- 394
- 1
- 6
This happens when you switch between versions of xcode. Simple solution is to quit xcode and simulator. Relaunch xcode and at the same time clean the simulator befor running. This should solve the problem.

- 1
I had this problem because I had another user on the same machine running the iOS simulator. Logging in as the other user and quitting the simulator (and Xcode) solved it in my case.

- 1,714
- 14
- 27
Step1: ping
$ ping localhost
This should return something like
PING localhost (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.028 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.048 ms ...
If this works, this answer won't fix your problem, try something else.
If ping return something else for example: ping: cannot resolve localhost: Unknown host something is screwed up with your /etc/hosts file, go to Step 2 Step2: Check /etc/hosts
Check that the top of your /etc/hosts file looks like this
127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost
If it doesn't have these entries in the file, enter them at the top of the file, flush the dns cache using $ dscacheutil -flushcache and go back to Step 1, otherwise continue to Step 3. Step3: Correct File Format: It should be unix or LF *
$ file /etc/hosts
This should return: /etc/hosts: ASCII English text
If it returns something like /etc/hosts: ASCII English text, with CR line terminators then the file is in the wrong format and is likely being ignored.
Change the file line endings to unix or LF using your favorite text editor.
In Sublime Text 2 this can be done throught the view menue: View > Line Endings > Unix
Flush the dns cache ($ dscacheutil -flushcache) and go back to step 1

- 2,585
- 3
- 24
- 31
Embarrassing late-night moment, but just for completeness... when you click "reset content and settings" on the emulator, of course the big blue default button says "DON'T reset", and the little white other button says "reset". If you're not paying attention it can be quite difficult to remember to read the buttons. I can't believe I'm admitting this but hey, happens to us all (right? :))

- 3,437
- 2
- 30
- 28
Some times it happens because you have two projects with same name. Try this:
- go to xCode preference choose location and click on DerivedData delete the DerivedData
- Reset and force Quit Simulator
- Force Quit The Xcode and restart
If it has not worked than restart your PC.
and another one for the record: (none of the suggestions worked for me)
Mountain Lion: XCode 4.6.3
- I
moved the whole Application to Trash
and deleted following other folders /Users/[USERNAME]/Library/Developer
/Users/[USERNAME]/Library/Caches/com.apple.dt.XCode
/Users/[USERNAME]/Library/Application Support/iPhone Simulator
reboot System and reinstall XCode

- 11,104
- 10
- 55
- 89