xcode xCode4 不会在模拟器中运行应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5265318/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
xCode4 won't run app in Simulator
提问by BlueShoe
I just downloaded and installed xcode4 with the latest SDK. I opened my project selected run and the simulator pulls up but stays black. All I see in the status window of XCode is 'Attaching to MyProjectName
我刚刚用最新的 SDK 下载并安装了 xcode4。我打开了我的项目选择运行,模拟器启动但保持黑色。我在 XCode 的状态窗口中看到的只是“附加到 MyProjectName”
回答by Hiedi
check out my blog post for how to get around this -- basically you need to delete your xcuserdata for the project. http://hiediutley.com/2011/03/10/xcode4-is-your-old-project-hanging-in-the-simulator/
查看我的博客文章,了解如何解决这个问题——基本上,您需要删除项目的 xcuserdata。http://hiediutley.com/2011/03/10/xcode4-is-your-old-project-hanging-in-the-simulator/
回答by David Hancock
I've been struggling with this same problem for half a day! Finally I managed to solve my issue.
我已经被这个问题困扰了半天了!最后我设法解决了我的问题。
My applications plist file had been heavily modified, so I created a new application and compared my plist values to the new one. My plist file had a hard coded string set for the Executable file
value, changing this solved my issue.
我的应用程序 plist 文件已被大量修改,因此我创建了一个新应用程序并将我的 plist 值与新值进行了比较。我的 plist 文件为该Executable file
值设置了一个硬编码字符串,更改它解决了我的问题。
- Open up your
ApplicationName-Info.plist
file - Check the value for
Executable file
is set to${EXECUTABLE_NAME}
- Clean, Build, Run
- Clean, Build, Run again.
- 打开你的
ApplicationName-Info.plist
文件 - 检查值
Executable file
是否设置为${EXECUTABLE_NAME}
- 清理、构建、运行
- 清理,构建,再次运行。
I'm not sure why I had to Clean, Build, Run twice, but it failed to launch the first time.
我不知道为什么我必须清理、构建、运行两次,但第一次启动失败。
Hopefully this works for you. Try changing some of the other values back to their defaults if this doesn't work as it may still be an issue with your plist file.
希望这对你有用。如果这不起作用,请尝试将其他一些值更改回它们的默认值,因为它可能仍然是您的 plist 文件的问题。
回答by James Boutcher
There are a lot of different solutions people suggest for this:
人们为此提出了很多不同的解决方案:
- Do a clean
- Reset simulator
- Do a 'clean build folder' (hold down option key when selecting clean)
- Remove ~/Library/Developer Tools/Xcode/Derived Data/YourProject*
- Remove your 'xcuserdata' directory inside your .xcodeproj directory
- 做个干净
- 重置模拟器
- 执行“清理构建文件夹”(选择清理时按住选项键)
- 删除 ~/Library/Developer Tools/Xcode/Derived Data/YourProject*
- 删除 .xcodeproj 目录中的“xcuserdata”目录
I just spent an hour trying different combinations of the items above, doing all of them, ... nothing worked. My app would either 1) Immediately start and quit before launch screen would show up, or 2) Hang at launch screen. The simulator took forever to reset, sometimes wouldn't respond to a Quit, ... Just really odd stuff going on.
我只花了一个小时尝试上述项目的不同组合,做了所有这些,......没有任何效果。我的应用程序将 1) 在启动屏幕出现之前立即启动和退出,或者 2) 在启动屏幕上挂起。模拟器需要很长时间才能重置,有时不会响应退出,......只是发生了非常奇怪的事情。
Thissolved my problem: Reboot machine.
这解决了我的问题:重启机器。
(It blows my mind this had to be done on Mac OS, but it worked. This may have something to do with upgrading to XCode 4.6 and not rebooting since then, I'm not sure... But I'm back running again)
(这让我大吃一惊,这必须在 Mac OS 上完成,但它奏效了。这可能与升级到 XCode 4.6 并且从那时起没有重新启动有关,我不确定......但我又回来了)
回答by Leon Lopez
What did the trick for me is:
对我来说有什么窍门是:
- Open the project navigator
- Click on Build Phases
- Use the search tool and check if there is result for info.plist. If there is result, remove it.
- Build and run
- 打开项目导航器
- 单击构建阶段
- 使用搜索工具检查 info.plist 是否有结果。如果有结果,将其删除。
- 构建并运行