Hello,world!

文科的格调 + 工科的背景 = 爱浪漫的程序媛

Xcode4 attaching to appname问题解决方法

 

please note, this is not a sequence of steps. each one is a possible solution:

1- restart xcode and/or restart simulator (reset content and settings) and/or restart computer.

2- click on project name in project navigator. in build settings tab, go to packaging and make sure that “Product Name” is the same that the one xcode says simulator is attaching to when running. if they are different, it will fail.

3- go to your projectname.xcodeproj folder. inside there delete anything named with your userid. when you reopen xcode those files will be recreated and it should work…

4- Manually delete the build directory for your project.

5- Go to organizer window. select Projects, select your app in the left hand side and then delete over “Derived Data”

6- Check Launch option is set to “Automatically” in Product->Edit Scheme, “Run” scheme.

7- In Project->”Edit Schemes”->Run. Change the Debugger from GDB to None (this doesn’t make sense to me..).

8- Kill the process gdb-i386-apple-darwin from Activity Monitor. this is assuming gdb is not responding.

9- In “Product”->Edit Scheme. in Run, click yourappname.app, choose other, navigate to your .app in your project. now run.

10- Check that you don’t have two different Info.plist in your project. if you do, remove the bad one.

 

        小幻试到第七条,问题解决,发现这个LLDB出了点儿问题。想要重新编译一下,未果。

       反省一下,好久不写代码,回到了最初不淡定的状态,于是非常之暴躁,不停的试,不停的试。感觉自己有点儿完美主义,非得从彻底解决这个问题才可以,不然就很不舒服。在日常开发中,这一点是要不得的,会极其耽误效率。

       人生啊,有个度就好,凡事不要得过且过,但是也不要太过斤斤计较。

====================================我是时光的分割线==2014-3-1===========================

PS:一年多以后,终于给我发现为什么LLDB不正常了,这一问题也有了新的更好的解决方案。先贴上stackflow的问题解答链接。

Why does the LLDB Debugger constantly fail to attach?

This doesn’t mean you need an internet connection in order to debug, as 127.0.0.1 is the loopback interface (Google that for details) and it’s simply that lldb (and gdb) uses TCP for its interprocess communication mechanism.

LLDB attaching to app其实是在跟这个进程通信,中间需要用localhost映射到本机地址127.0.0.1进行回调,我们常常为了各种原因修改hosts文件,LLDB在hosts文件中找不到映射,也就会一直保持在这个步骤,没办法跟进程通信了,就卡住了。所以,只要保证localhost映射到127.0.0.1问题就解决了。

真是一个困扰我好多年的问题,终于解决了。

  1. Sillvester说道:

    这东西是Windows平台还是mac平台下的啊

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.