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

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

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


当前回答

以下是我在4.3.3版本中使用的方法:

在XCode中删除派生数据文件夹。无明显不良影响。

打开Finder,打开文件夹-> ~/Library/Developer/Xcode/DerivedData/ (Shift-Command-G)。

希望这能帮助那些尝试过其他方法的人……

其他回答

我试着使用所有的解决方案,但没有一个对我有效。 我意识到问题发生了,当Info。plist已设置任何目标会员。

尝试签出所有名为Info.plist的文件的Target Membership (Utilities)中的所有复选框。

这对我来说很管用:

在Xcode中导航到Product菜单并选择EDIT SCHEMES。

在左边的列表中选择Run YourAppName.app。从可执行菜单中选择OTHER。

导航并选择项目目录中的.app文件。

现在运行,它工作:)

以下是我们的解决方案:

在项目>编辑方案>运行。

将调试器从GDB更改为None(正位于上图中绿色圆圈的上方)。

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,这样就可以非常快速地解冻模拟器而不使用鼠标。

当我用最新版本的xcode在lion上运行时,也遇到了同样的问题。它运行这个“有用的”向导来切换我的项目设置,使用LLDB而不是我认为很好的GDB。

这并不好。对于我们的项目,LLDB只是拒绝附加,然后导致项目挂起,没有任何错误消息。切换回GDB手动解决了这个问题。

你可以在“管理方案”中完成