Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4.4 on iOS 5.1 build succeeds but run hangs on simulator with debug message 'Failed to attach to process id <pid>'

Symptoms: Running any iOS 5.1 application from Xcode 4.4 (and 4.4.1) will launch the iPhone simulator but result in a plain black screen. In the Xcode console, the message "error: Failed to attach process to id " is displayed, being different each time. Attempting to 'Stop' the application from Xcode does nothing, and only Force Quit will return Xcode to a working state. Pressing the 'Home' button on the simulator shows that the app was successfully installed. Sometimes, opening the app from the simulator will show the UI, but no console messages are displayed, even after manually performing 'Product->Attach to process.'

Attempted Solutions: Xcode 4.3.x was originally installed on Lion, working charmingly. The problem started at installation of Xcode 4.4 in early August, for a project which was working before. I upgraded to Mountain Lion, didn't help. I reinstalled Xcode, didn't help. I upgraded to 4.4.1 Aug 7, didn't help. I deleted all trace of Xcode data, running: find / -name '[xX]code' and deleting all super-folders where it seemed relevant. That (not surprisingly) caused some OS issues, since subsequently reinstalling Xcode just didn't work. I then did it again, reinstalled Mountain Lion (to restore some OS files I probably killed), then reinstalled Xcode 4.4.1.

For projects, I typically ran new, single-view projects each time. Lately I've tried using this sample project from Apple, per link 3 below. I tried all the clean builds, etc., but honestly, one would assume opening a fresh project should just work. Just for kicks, I put a single 'Label' object in the iPhone storyboard at times.

After doing some homework I managed to find the following questions most similar to mine, but none are exact nor do any of the solutions work (in order of decreasing relevance):

  1. xcode-4-4-ios-5-1-simulator-problems
  2. crash-of-xcode-4-4-for-mac
  3. failed-to-attach-to-process-id-xcode
  4. unit-test-target-doesnt-run-on-xcode-4-5
  5. xcode-4-4-freezing-on-project-close
  6. simulator-keeps-crashing-in-xcode-4-4

Any help would be greatly appreciated. I apologize for the lack of brevity, but I've spent probably 15 hours trying to find/implement solutions to a seemingly trivial problem, and I would rather provide all relevant information than to have you guess at what I did. I'm not going to specify all the build info, just because it's whatever comes stock on the fresh install of Xcode.

like image 999
marc Avatar asked Aug 10 '12 13:08

marc


People also ask

What is debug executable in Xcode?

The “Debug executable” checkbox specifies whether or not you want to run with the debugger enabled. Once running, you can use Debug > Attach to Process on a process that has been launched with debugging disabled if needed. It seems like all this does is start your app with the debugger attached.

What is PID in Xcode?

The ID of the process that generated this event. macOS 10.2+

How do I attach a process in Xcode?

We launch the application and choose Attach to Process from Xcode's Debug menu. Xcode helps us by showing us a list of likely targets at the top. When we choose the process we're interested in, the Stop button is enabled indicating that the debugger is successfully attached to the process.

How do I edit schemes in Xcode?

Choose "Edit Scheme" from the "Product" menu. Click on the "Manage Schemes…" button. Select the scheme whose name you wish to change. Press the "Return" key.


1 Answers

I had similar problem (although with different configuration) and found incredibly simple solution by chance. I just used Product->Stop, then Product->Run (through keyboard shortcuts if that matters). Just once! Then the problem disappeared.

configuration: XCode 4.2, iPhone Simulator 5.0 symptom difference: process attaching didn't fail

It seems to me that the problem stems from the XCode-Simulator communication, and that's why I've shared my experience here despite the differences.

EDIT: It comes out Stop; Run didn't provide permanent solution for me. The problem is recurring from time to time. Still it is a temporary workaround for me.

like image 56
Dimitar Vlasev Avatar answered Sep 21 '22 15:09

Dimitar Vlasev