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

5

6

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.

Ossetic answered 10/8, 2012 at 13:3 Comment(2)
I haven't looked at the posts you reference but I normally solve this by deleting the app from the simulator and perhaps deleting DerivedData (and restarting Xcode).Sangfroid
Per my comment to the answer below, tried this, and it did nothing.Ossetic
O
0

While this isn't exactly a solution, after today's OSX 10.8.1 update from Apple, this issue has been resolved. It's safe to say that some bug arose in the process of installing Mountain Lion and Xcode 4.4 that was fixed with this update to OSX.

Ossetic answered 2/9, 2012 at 13:41 Comment(0)
V
2

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.

Vestryman answered 22/9, 2012 at 10:38 Comment(1)
I don't think this is relevant to the problem I was facing. It seems clear now that a bug arose from a bad upgrade that was fixed in the patch noted in the marked answer.Ossetic
S
1

I got this a few times, especially when I kept running my app and cancelling it or interrupting it too often, it's not something you can put your finger on, but yes I always managed to get back up and running by deleting the app in the simulator, cleaning project and build folder, deleting derived data (in Xcode organiser > projects view), restarting simulator and Xcode.

This also happened a few times on the device, and I needed to restart the device, iPhone in my case. I hope these infos help you out.

Salesin answered 11/8, 2012 at 0:54 Comment(1)
It seems reasonable, but I tried all of this per the solutions in the attached posts. I deleted the derived data just by opening a terminal window. I couldn't find the 'Xcode Organizer -> Projects View' you're referring to. I also reset the simulator as well.Ossetic
A
0

I got this to work by building and running the simulator using the Xcode 4.5 developer preview. I then closed it out and reopened Xcode 4.4.1 and it built and ran fine.

While none of the solutions above worked for me, thanks for putting this all together. I figured I'd answer here since this was the most comprehensive.

Apices answered 21/8, 2012 at 18:31 Comment(1)
Thanks for the heads up! I have a university license and cannot download the developer preview. It seems I might have to wait for it to be released to all users.Ossetic
O
0

While this isn't exactly a solution, after today's OSX 10.8.1 update from Apple, this issue has been resolved. It's safe to say that some bug arose in the process of installing Mountain Lion and Xcode 4.4 that was fixed with this update to OSX.

Ossetic answered 2/9, 2012 at 13:41 Comment(0)
V
0

I think I've cracked this one for my particular case, and I admit it's somewhat a mistake only newbies should do but I had overrided

  • viewWillApear:(bool)animated {}
  • in a ViewController of mine, without calling back
  • [super viewWillApear:animated]
  • It might be a good idea to search for all view lifecycle methods in your project and see if you have similar problem.

    Vestryman answered 14/2, 2013 at 18:40 Comment(0)

    © 2022 - 2024 — McMap. All rights reserved.