0

I've duplicated a target in Xcode 4, but when I hit run, the application starts and gets stuck in the launching screen and I've got an error in the Xcode console:

error: failed to attach to process ID 3957

I've already searched on the internet for some possible solutions but all of them didn't seem to solve this issue.

Any other clues?

Hailei
  • 42,163
  • 6
  • 44
  • 69
noTest
  • 159
  • 1
  • 3
  • 12
  • I don't believe this has anything to do with the duplicate target. XCode has some kind of bug that it sometimes cant attach to the process. Usually fixed by force-quitting iOS Simulator and restarting XCode (or rebooting). I wrote an article about a similar problem, the script I wrote might work for this problem as well. http://paulpeelen.com/2011/12/13/tool-fix-sigabrt-problem-when-developing-in-xcode/ – Paul Peelen May 07 '12 at 07:59
  • restarting / rebooting didn't seem to solve the problem – noTest May 10 '12 at 13:22
  • Can you try what I have written [here](http://stackoverflow.com/a/10323839/406677). Reset XCode might help, its just a guess though. – Paul Peelen May 10 '12 at 13:26

2 Answers2

0

When you duplicate the target, the project will try to use the same bundle ID. Which in some cases is not what you want. Try changing it if you don't need to use the same bundle identifier.

Vaseltior
  • 1,226
  • 15
  • 27
0

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

Shahid Aslam
  • 2,585
  • 3
  • 24
  • 31