Xcode 错误:无法启动模拟应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/822972/
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
Xcode error: Failed to launch simulated application
提问by springrider
Problem
问题
Unlike people have asked at hereand here, I got this error after a brand new installation of Leopard (hackintosh), this problem really driving me crazy and nowhere else to find an clue, I googled and visited every article related with this, still can't get it solved.
不像人们在这里和 这里问过,我在全新安装 Leopard (hackintosh) 后遇到了这个错误,这个问题真的让我发疯,无处可寻,我用谷歌搜索并访问了与此相关的每篇文章,仍然可以解决不了。
After the first time install iPhone SDK 2.2.1, start a new project(any type, Navigate based, OpenGL ES application), then build and go, I got the following problem: sometime it's:
第一次安装 iPhone SDK 2.2.1 后,启动一个新项目(任何类型,基于导航,OpenGL ES 应用程序),然后构建并运行,我遇到以下问题:有时是:
Failed to launch simulated application: Unknown error.
无法启动模拟应用程序:未知错误。
and sometimes it's:
有时是:
Failed to launch simulated application: iPhone Simulator failed to find the process ID of com.yourcompany.[application name]
无法启动模拟应用程序:iPhone 模拟器未能找到 com.yourcompany.[应用程序名称] 的进程 ID
It seems that apps in the simulator crashed immediately, so Xcode can find the process ID.
模拟器中的应用程序似乎立即崩溃,因此 Xcode 可以找到进程 ID。
Solution
解决方案
This linksays that this even can't be solved. Some others make a detailed step by step:
这个链接说这甚至无法解决。有的人一步一步做详细的说明:
- Uncheck Info.plist
- Quit XCode
- Delete directory /Lib/Caches/com.apple.DeveloperTools.###
- Open Xcode project
- Clean All Targets
- Rebuild
- 取消选中 Info.plist
- 退出 XCode
- 删除目录/Lib/Caches/com.apple.DeveloperTools.###
- 打开Xcode项目
- 清理所有目标
- 重建
and I reset the iPhone Simulator. This also didn't solve the problem…
我重置了 iPhone 模拟器。这也没有解决问题……
I've even tried uninstall the SDK and reinstall it, still got the same error…
我什至尝试过卸载 SDK 并重新安装它,仍然出现相同的错误......
Is this a problem related with hardwares? or the operating system version? I'm using a hackintosh (iDenebv1.4 10.5.6), all other software works good including iTunes && vmware fusion.
这是与硬件有关的问题吗?还是操作系统版本?我正在使用 hackintosh (iDenebv1.4 10.5.6),所有其他软件都运行良好,包括 iTunes && vmware fusion。
Great thanks for any further tips or clues!
非常感谢您提供任何进一步的提示或线索!
采纳答案by springrider
found some wierd log in /var/log/system.log.
在 /var/log/system.log 中发现了一些奇怪的日志。
May 8 16:17:50 th084134 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System/Library/CoreServices/SpringBoard.app/SpringBoard[1170]: MobileInstallationLookup: Generating the install map
May 8 16:17:50 th084134 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System/Library/CoreServices/SpringBoard.app/SpringBoard[1170]: load_application_info: Could not load signer identity from /Users/test/Library/Application Support/iPhone Simulator/User/Applications/5D55807A-7489-4DC5-B4D7-2ECD5E230F29/new1.app/new1
May 8 16:17:50 th084134 [0x0-0x2e02e].com.apple.iphonesimulator[1168]: error compiling query "SELECT value FROM _SqliteDatabaseProperties WHERE key = ?;": no such table: _SqliteDatabaseProperties
May 8 16:17:51 th084134 SpringBoard[1170]: Unable to obtain task name port for com.yourcompany.new1. Either it failed to exec or it terminated immediately: (os/kern) failure
May 8 16:17:51 th084134 SpringBoard[1170]: Couldn't activate <SBApplication: 0x123e6d0> com.yourcompany.new1 activate: animated deactivate:
May 8 16:17:51 th084134 SpringBoard[1170]: Application <SBApplication: 0x123e6d0> com.yourcompany.new1 activate: animated deactivate: exited abnormally with signal 256: Unknown signal: 256
May 8 16:17:51 th084134 SpringBoard[1170]: Unable to obtain task name port for com.yourcompany.new1. Either it failed to exec or it terminated immediately: (os/kern) failure
May 8 16:17:51 th084134 com.apple.launchd[164] (UIKitApplication:com.yourcompany.new1[0xa455][1171]): Bug: launchd_core_logic.c:2812 (23714):103: sandbox_init(j->seatbelt_profile, j->seatbelt_flags, &seatbelt_err_buf) != -1
May 8 16:17:51 th084134 com.apple.launchd[164] (UIKitApplication:com.yourcompany.new1[0xa455][1171]): Sandbox failed to init: Cannot apply builtin profile `/Users/test/Library/Application Support/iPhone Simulator/User/Applications/5D55807A-7489-4DC5-B4D7-2ECD5E230F29.sb': Policy not found
May 8 16:17:51 th084134 com.apple.launchd[164] (UIKitApplication:com.yourcompany.new1[0xa455][1171]): Exited with exit code: 1
May 8 16:17:51 th084134 [0x0-0x2e02e].com.apple.iphonesimulator[1168]: 2009-05-08 16:17:51.026 SpringBoard[1170:10b] Unable to obtain task name port for com.yourcompany.new1. Either it failed to exec or it terminated immediately: (os/kern) failure
Hereis a discussion about how to run app in simulator via command line, hope it helps to understand how does xcode and simulator works.
这是一个关于如何通过命令行在模拟器中运行应用程序的讨论,希望它有助于理解 xcode 和模拟器是如何工作的。
But I didn't work it out.
但我没有解决。
Well, I "solved" it by install another distribution of hackintosh(IPC 10.5.6),works perfect!
好吧,我通过安装另一个hackintosh(IPC 10.5.6)发行版“解决”了它,完美运行!
回答by springrider
FIXED For the issue: iPhone Simulator failed to find the process ID of com.yourcompany.[your application name]
已修复针对以下问题:iPhone 模拟器无法找到 com.yourcompany.[您的应用程序名称] 的进程 ID
I was having an issue building and simulating a project I built under OS Version 2.2.1, which I could no longer get to build and run in the simulator for XCode 3.1.4, even though I forced XCode to build for "Simulator - 2.2.1 Debug"
我在构建和模拟我在 OS 版本 2.2.1 下构建的项目时遇到问题,我无法再在 XCode 3.1.4 的模拟器中构建和运行该项目,即使我强制 XCode 为“Simulator - 2.2”构建.1 调试”
I was able to get past this problem by: - Close the iPhone Simulator - Putting XCode into View->Detail - Opening the "Info.plist" file in the "Resources" folder - Near the top of the file you should see "Info.plist" with and up/down arrow selector - Click on the up/down arrow selector - Select "Clear File History"
我能够通过以下方式解决这个问题: - 关闭 iPhone 模拟器 - 将 XCode 放入 View->Detail - 打开“Resources”文件夹中的“Info.plist”文件 - 在文件顶部附近,您应该看到“Info .plist”和向上/向下箭头选择器 - 单击向上/向下箭头选择器 - 选择“清除文件历史记录”
Built For: Simulator - 2.2.1
专为:模拟器 - 2.2.1
XCode Version: 3.1.4 (Which includes OS3.1 Beta 3)
XCode 版本:3.1.4(包括 OS3.1 Beta 3)
回答by Ansari
I had the same issue last night, and suddenly my system got reboot. At that moment, i was trying to install an application into simulator. When system returned, and i tried again to install the app, it said, "Failed to launch simulated application"
我昨晚遇到了同样的问题,突然我的系统重新启动。那时,我正在尝试将应用程序安装到模拟器中。系统恢复后,我再次尝试安装该应用程序时,它说“无法启动模拟应用程序”
Than i did googled it, and tried many solutions, like cleaining all targets and try building again, but didn't worked out.
比我用谷歌搜索它,并尝试了很多解决方案,比如清理所有目标并再次尝试构建,但没有成功。
So i have found the following link, where it is described, how to reset the iPhone Simulator contents:
所以我找到了以下链接,其中描述了如何重置 iPhone 模拟器内容:
I tired doing it, and you guys would'nt believe me, it worked :) ,
我厌倦了这样做,你们不会相信我,它奏效了:),
Solution was : "To set the user content and settings of the simulator to their factory state and remove the applications you have installed, choose iPhone Simulator > Reset Content and Settings"
解决方案是:“要将模拟器的用户内容和设置设置为出厂状态并删除您已安装的应用程序,请选择 iPhone 模拟器 > 重置内容和设置”
Best of Luck to all.............. :)
祝大家好运........ :)
回答by Jordan
This ends up being a product name issue:
这最终成为产品名称问题:
The fix is to revert back to
解决方法是恢复到
${EXECUTABLE_NAME} ${PRODUCT_NAME}
${EXECUTABLE_NAME} ${PRODUCT_NAME}
for the executable file and com..${PRODUCT_NAME} in the info.plist.
对于 info.plist 中的可执行文件和 com..${PRODUCT_NAME}。
Clean XCode, Quit, rese and quit simulator and you're good to go.
清理 XCode、退出、重新设置和退出模拟器,你就可以开始了。
回答by Matt Nambot
I had the same problem, I fixed it by launching the simulator through another app and deleting the app I was trying to run on it. Then try to build and run and worked perfect.
我遇到了同样的问题,我通过另一个应用程序启动模拟器并删除我试图在其上运行的应用程序来修复它。然后尝试构建和运行并完美运行。
Cheers
干杯
Matt
马特
回答by m0bl
Simply delete the app from the simulator (and/or device if you're attempting to run on your device) via the UI of the simulator, then shut the simulator down and attempt to re-run the app. Doing the deletion of the actual files backing the simulator will also remove the app and do the same thing (but the deletion via the simulator's UI, if it works for you, is a little bit faster and easier).
只需通过模拟器的 UI 从模拟器(和/或设备,如果您尝试在您的设备上运行)中删除应用程序,然后关闭模拟器并尝试重新运行应用程序。删除支持模拟器的实际文件也将删除应用程序并执行相同的操作(但通过模拟器的 UI 删除,如果它适合您,会更快更容易)。
回答by Vladi
I had the same problem. I had accidentally added my info.plist file to my target and it was getting copied to the app bundle every time I built the application. So there were 2 .plist files in the bundle - mine and the Info.plist, created by XCode - which confused the simulator.
我有同样的问题。我不小心将 info.plist 文件添加到我的目标,并且每次我构建应用程序时它都会被复制到应用程序包中。所以捆绑包中有 2 个 .plist 文件——我的和 XCode 创建的 Info.plist——这让模拟器感到困惑。
回答by Howard Cohen
In my case, I was adding a target to an existing app that had always worked. In my case, I had forgotten to select all the source code, xibs, frameworks, etc. and click their target checkbox. My clue was that the build happened instantaneously, which didn't make any sense. It never built anything. It just failed to install in the simulator. Once I included all the source files, etc., for the new target, then it built and installed fine.
就我而言,我正在向一直有效的现有应用程序添加目标。就我而言,我忘记选择所有源代码、xib、框架等,然后单击它们的目标复选框。我的线索是构建是瞬间发生的,这没有任何意义。它从未建造过任何东西。它只是在模拟器中安装失败。一旦我为新目标包含了所有源文件等,然后它就可以正常构建和安装。
回答by springrider
I fixed this problem by removing the "Icon already includes gloss and bevel effect" property from the Info.plist file in my project.
我通过从我的项目的 Info.plist 文件中删除“图标已经包含光泽和斜角效果”属性来解决这个问题。
回答by fbrereto
My problem centered around a Product Name the simulator simply wouldn't accept. Picking alternative names got me past the problem. Changing the name back to the original suspect choked the simulator every time.
我的问题集中在模拟器根本不接受的产品名称上。选择替代名称让我解决了这个问题。每次把名字改回原来的嫌疑人都会让模拟器窒息。