19

After I run my iPhone project in iPhone Simulator Xcode 4.6 t hangs at the "Running in iPhone 6.1 Simulator" stage every 2nd or 3rd time. Yes, at such regular basis.

It hangs on almost every project I run and on my 2 Mac machines (Mac Mini 8GB, Core 2 Duo, SSD drive and MacBook Pro Core 2 Duo 3,1 Ghz, 8BG RAM, SSD Drive)

This was also the issue in previous Xcode but it has been occurring rarely enough to be tolerable.

I need to restart my Xcode and simulator to be able to run project again (sometimes even restart OS X).

What causes this and what can we do besides restarting Xcode to solve it? Why Apple can't resolve this issue for such a long time?

UPDATE:

I got flagged that this question is unconstructive, with what I do NOT agree as my main and first question was:

What causes this regular hangs? Why Apple has not solved it for such a long time is not my main interest.

Main concern stays very practical and technical: what is the reson of such regular disfunction and is there something developer can do manually to help it?

After all: Xcode is just a tool we use at work and every knowledge which can gain productivity is valuable.

UPDATE 2:

** After reinstalling to the newestMac OS X Lion (clean install) and installing newest Xcode, iTunes, Safari, iPhone Simulator problem persists.** This is clearly Xcode or iPhone simulator bug.

Lukasz
  • 19,816
  • 17
  • 83
  • 139
  • 1
    For me, it usually helps to manually stop any existing debugging sessions before starting the new one. – Till Jan 31 '13 at 18:41
  • Yeah, but when for a first time - you try to fire new session without stopping the new one, Xcode asks you it you want to stop already running session (with "Don't ask again"). So session is stopped anyway automatically before new starts. I am just curious why this has not been improve for such a long time. – Lukasz Jan 31 '13 at 18:51
  • 1
    Unconstructive. No one here can say why Apple does or doesn't do something. – matt Jan 31 '13 at 18:54
  • Not necessarily unconstructive - it may be technical reason for that. There may be general flaw in how debugging session is managed my Xcode and maybe there is something developer should now to help solve it manually (kill some process) – Lukasz Jan 31 '13 at 18:58
  • 2
    It's a bug in XCode, and a severe one at that. It's driving me crazy. – Warren P Feb 14 '13 at 14:42
  • It's a pretty old problem that keeps popping up. So, possibly flag this question as a duplicate? [1](http://stackoverflow.com/questions/5382968/xcode-4-hangs-at-attaching-to-app-name) [2](http://stackoverflow.com/questions/11645747/xcode-4-3-3-iphone-5-1-simulator-hanging-every-so-often) [3](http://stackoverflow.com/questions/10168922/xcode-4-3-2-issue-with-running-on-simulator) [4](http://stackoverflow.com/questions/10205455/xcode-4-3-2-process-hangs) – Kitt Basch Aug 19 '13 at 10:25

4 Answers4

4

I have experienced the same thing many times, often many times a day, not necessarily after a crash. So yes, the bug exists and I've reported it to Apple and have continued to revise the report as data warrants. You should do the same (and provide Apple with a Sample report to show what the threads are doing during the hang each time). This has nothing to do with PLCrashReporter; I can experience this problem with a bare template project. Your question, though, seems unconstructive, as no useful answer can be given. Who can possibly tell you why Apple hasn't fixed it? The only people who can tell you that would be Apple, and you know that they won't tell you. So your question is purely rhetorical. :)

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Don't you think it may be valuable for others to find out / discover better, more efficient solution to this problem than restarting the Xcode every time (which is very unproductive an time consuming)? – Lukasz Jan 31 '13 at 19:09
  • There is no better solution. I experience this problem completely unpredictably. There is no way to avoid it. When it happens, it happens. At that point, Xcode is wedged. The only solution is to force-quit Xcode. – matt Feb 01 '13 at 03:55
  • This is so dissapointing. Now on by big project every time when I am working on new experimantal feature and get crashes - I spend half of my time restarting damn Xcode! I have never been so frustrated with it! – Lukasz Feb 01 '13 at 11:26
2

I found an fix on a similar post. Make sure that '127.0.0.1 localhost' is in your etc hosts file. This fixed it for me and I had been getting the 'hanging attaching to simulator' issue 100% of the time.

alien12
  • 21
  • 1
  • 1
    I have this entry in my etc/hosts file and it does not help – Lukasz Feb 03 '13 at 10:16
  • Works for me! I happened to play around with this file while configuring virtual hosts for MySQL. I have no idea why this affected XCode debugger - but would admire if someone makes a good guess. – Manav Sharma Feb 06 '13 at 05:00
1

I've had the same issues, found that it was related to the newest iTunes since when I unplugged my iPhone target, the color wheel would go away. I've since down rev'd iTunes to 10.7 and the problem is gone. The newer iTunes seem's to get stuck querying the iPhone, and can't progress. I'm running Mac OS X 10.7.5 on an old iMac. I don't have this problem running on a MacBook with 10.8 and the latest iTunes.

Pat
  • 71
  • 4
  • Did not work for me. I updated to the latest know iTunes now (11.0.2 64bit) and nothing changed. – Lukasz Feb 26 '13 at 14:35
1

I have noticed that you can significantly decrease occurrence of this bug by running app on simulator like this:

  • first run on simulator is okay, it won't freeze when uploading app to simulator
  • when you want to re-run the app, make sure to stop the previous execution first by pressing stop (or key cmd+.) and wait 3-5 seconds
  • run the app (cmd+r)

By waiting few seconds after stopping the app it seems to prevent the Xcode execution freeze. I think that the debugger doesn't have enough time to detach and reattach so it hangs.

frin
  • 4,474
  • 3
  • 31
  • 23