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

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

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


当前回答

在Xcode 4中重命名项目后,我经常遇到这个问题。

我可以通过编辑.plist文件中的Bundle Identifier来修复它。

在我重命名项目后,Bundle Identifier会变成这样:

com.yourcompany.${PRODUCT_NAME:rfc1034identifier}

改回如下:

com.yourcompany.${PRODUCT_NAME}

将停止Xcode挂起并允许应用程序运行。

其他回答

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

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

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

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

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

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

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

Xcode 4.6.3更新(2013年6月13日)解决了以下问题:

在OS X 10.8.4上的iOS模拟器中调试时挂起。13722320

https://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-Xcode/

你可以尝试更新你的Xcode,看看这是否适合你。安装新的XCode版本并重新启动XCode后,问题就解决了。

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

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

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

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

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

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

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

祝你好运=)