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

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

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


当前回答

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

其他回答

对于那些在上面尝试了所有这些之后仍然试图解决这个问题的人,尝试重置iPhone模拟器。

Simulator > Device > Erase All Content and Settings...

这将删除模拟器中的所有应用程序,但现在你终于可以使用模拟器了!

对我来说,这个解决方案(和其他许多人的解决方案一样)完全是奇怪和罕见的。

我所做的很愚蠢:

1.—Product—>编辑方案—>执行 2.-点击“可执行名称”(Whatever.app),展开选项,然后点击“其他” 3.-导航到“调试-iphone模拟器”目录,并“重新选择”您原来的不可工作的Whatever。应用程序文件名 4.-尝试运行/清理项目。 5.-重新构建并运行模拟器。

一旦我这么做了,我的管他呢。应用程序终于工作了:)

(但是在尝试了这里和其他地方的所有东西之后,天哪!如此令人沮丧的! !)

我有这个问题,但问题不同。

另一个应用程序正在尝试向密钥链添加证书,并且由于某种原因(网络?)而挂起。重复这几次,只有当钥匙链是免费的,xcode才能运行应用程序。

我什么都试过了。我的“包装器扩展”是空的,应用程序没有安装在模拟器。我把“包装器扩展”改为“应用程序”,现在它安装在模拟器中。

它仍然挂在附加到APP_NAME…

编辑 升级到Xcode 4.3,几次重新启动和清洁&构建,现在工作....

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

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.