Resolving “error: failed to attach to process ID 0” in Xcode

This was a bitch to track down.

error: failed to attach to process ID 0

Basically it means Xcode is not able to attach a build of your app to the simulator. I was, however, able to build it directly on the iPhone. To solve this problem, simply do the following:
* 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 <em>Your_Project_Name</em>.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

Restart Xcode and the simulator. And Bob’s your uncle.