Xcode Attaching to 卡死问题!

官方给的解释:

In xcode 4.2, sometimes when you’re going to run your ios proj on simulator, the status windows says “Attaching to myapp”, and just gets stuck there… until you cancel. Now, this has been asked before:XCode 4 hangs at “Attaching to (app name)”

and surprisingly, besides the accepted answer on that thread, there are at least 10 other possible solutions others have been adding, all for the same issue, people says one of them worked while the others didn’t…

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.

Google翻译如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
在Xcode4.2,有时,当你要在模拟器上运行的IOS凸出,状态窗口说:“连接到MyApp的”,只是被卡在那里......直到你取消。现在,这已被问过:XCode的4挂在“连接到(应用程序名称)”
 
而奇怪的是,除了该线程上公认的答案,至少有其他10个可能的解决方案,其他人已经加入,都为同一个问题,人们说,其中一人工作,而其他人没有? 
 
请注意,这不是一系列步骤。每一个是一个可能的解决方案: 
 
1-重启xcode的和/或重新启动模拟器(重置内容和设置)和/或重新启动计算机。 
 
2-点击项目导航项目名称。在构建设置选项卡,进入包装,确保“产品名称”是一样的一个Xcode中说,模拟器安装运行时。如果它们是不同的,它会失败。 
 
3-去你projectname.xcodeproj文件夹。里面有删除任何命名你的用户ID。当你重新打开Xcode的这些文件将被重新创建,它应该工作... 
 
4-手动删除build目录为您的项目。 
 
5转到组织者窗口。选择的项目,在左侧选择您的应用程序,然后删除了“导出数据”
 
6检查启动选项,在产品展示 - >编辑计划,“运行”计划设置为“自动”。 
 
7-在Project - >“编辑方案” - >运行。从GDB更改调试器无(这并没有什么意义,我..)。 
 
8杀死进程GDB-I386-苹果达尔文从活动监视器。这是假设GDB没有响应。 
 
9-在“产品” - >编辑计划。在运行中,单击yourappname.app,选择其他,浏览到您的项目的。应用程序。现在运行。 
 
10检查,你不能有两个不同的Info.plist在您的项目。如果你这样做,去掉坏的。

我解决的方法是这当中的第7条,翻译一下:
Xcode菜单栏 Product — Scheme — Edit Scheme… 打开如下所示页面

QQ20141031-1@2x

将该选项设置成None就可以了,如果还有问题,把模拟器还原一下,重启下Xcode与模拟器,应该搞定!

Leave a Reply