我刚刚升级到Xcode 4,由于某种原因,我的应用程序无法在模拟器或iOS设备上运行。它在Xcode 3中工作得很完美,但现在当我按下运行时,程序突然停在“附加到…”似乎也没有任何其他信息可以帮助解决这个问题。

总的来说,你可以尝试以下方法来解决这个问题:

重新启动模拟器。 确保你没有包含信息。plist文件在你的构建阶段->复制捆绑资源。 Resources文件夹作为文件夹引用添加到项目中(蓝色文件夹图标)。这导致了问题,在将文件夹作为一个组添加后,问题就消失了。


当前回答

我尝试了这个页面中的所有方法,对我有效的“新”解决方案是进入模拟器,在iOS模拟器主菜单中“重置内容和设置”。

其他回答

I was having this very annoying issue since a long time too. I've 3 different XCode versions installed and I'm not sure whether it's the reason or not that none of the above solutions worked for me. But here is the solution I finally found: I don't kill the running Simulator, I just try to launch it again using a Spotlight search, enter "Simu" and you should find it in Applications, then hit Enter. As it's yet running it will magically start my app that was frozen/locked/waiting for attachment. It works perfectly for me now and I hope it will also work for some (all?) of you.

顺便说一句,我用Cmd+空格来调用Spotlight,这样就可以非常快速地解冻模拟器而不使用鼠标。

这里给出的答案没有一个对我有帮助。

我在“编辑方案/信息”部分设置了“启动”单选按钮,以“等待MyApp”。而不是默认的“自动”。

它停止悬挂,现在它不启动模拟器,并在窗帘后面的日志中跟踪以下内容:

error: attach by name 'MyApp' failed
unable to create lldb_private::Process

在尝试谷歌它之后,这个错误似乎是一个相当罕见的。

我不期望这个错误适用于这里的所有情况,但无论如何,我希望我的帖子将为讨论的问题添加一些额外的细节。

Xcode: 4.4.1版本(4F1003)

固定它! !希望这能帮助一些人避免非常沮丧的几个小时。我用以下方法解决了这个问题:

Clicking on the project name in the left pane (at the very top). This will bring up a new menu to the right, something like the project/ target editors in XCode 3. Click on Build Settings up at the top. Under Packaging make sure your product name is the same for every build, and equal to whatever it says it's attaching to. Eg if XCode is Hanging at "Attaching to myLCBO" but your product name is "LCBO Finder" then it won't build. That was exactly my problem because I renamed my app half way through development.

就像Rob说的,还要检查“标识符”默认应该是“com.yourcompany”。我错误地更改了“yourcompany”,这导致了上面提到的相同问题。

我是如何解决这个问题的:

1) iOS模拟器->重置内容和设置…

2)确保项目名称、方案名称和目标名称一致。“AppName”和“AppName”不为真。必须为“AppName”+“AppName”,或者“AppName”+“AppName”。

3)重启XCode并退出模拟器。

生成设置中的项目名称->产品名称。

Product->中的方案名称管理方案。单击当前方案一次以重命名。

有目标的项目列中的目标名称。在当前目标上单击一次以重命名。

祝你好运=)