xcode 无法启动模拟应用程序:未知错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1262898/
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
Failed to launch simulated application: Unknown error
提问by Alexander Gladysh
- OS X 10.5.7 (genuine Mac)
- Xcode 3.1.3
- iPhone SDK 3.0
- OS X 10.5.7(正版 Mac)
- Xcode 3.1.3
- iPhone SDK 3.0
When I try to execute my iPhone application in simulator, I get the dreaded error message:
当我尝试在模拟器中执行我的 iPhone 应用程序时,我收到了可怕的错误消息:
Failed to launch simulated application: Unknown error.
My application has two targets, but this error occurs on both of them.
我的应用程序有两个目标,但是这两个目标都发生了这个错误。
When error occurs, the simulated OS hangs — it displays black screen and no longer responds on any input. Simulator application itself does not hang — all menus are active.
发生错误时,模拟操作系统挂起 - 它显示黑屏并且不再响应任何输入。模拟器应用程序本身不会挂起 — 所有菜单都处于活动状态。
All other applications I've tried running (mostly Apple samples) do work fine. Purging of caches, rebooting and howling on the Moon did not helped. Rebuilding project from scratch did not helped either. I guess I have to do it again in smaller steps.
我尝试运行的所有其他应用程序(主要是 Apple 示例)都可以正常工作。清除缓存、重新启动和在月球上嚎叫都无济于事。从头开始重建项目也没有帮助。我想我必须以更小的步骤再做一次。
Meanwhile, are there any other things to try than these below?
同时,除了下面这些之外,还有什么可以尝试的吗?
- Xcode | Empty Caches...
- Delete directory /Library/Caches/com.apple.DeveloperTools.###
- Full rebuild
- Reboot
- Change the product name (it did not contain any spaces anyway)
- Create new project and configure it manually from scratch
- Xcode | 清空缓存...
- 删除目录/Library/Caches/com.apple.DeveloperTools.###
- 完全重建
- 重启
- 更改产品名称(无论如何它不包含任何空格)
- 创建新项目并从头开始手动配置
A quote from the system.log:
来自 system.log 的引用:
12.08.09 0:13:59 [0x0-0xa70a7].com.apple.iphonesimulator[5368] -[MonitorController forwardEvents]: unable to send msg to ffffffff: 10000003 12.08.09 0:13:59 [0x0-0xa70a7].com.apple.iphonesimulator[5368] -[MonitorController forwardEvents]: unable to send msg to ffffffff: 10000003 12.08.09 0:14:03 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Unknown key for integer: JetsamPriority 12.08.09 0:14:03 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.apsd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory 12.08.09 0:14:03 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory 12.08.09 0:14:03 vot[9750] ******** AX INSPECTOR MODE ************ 12.08.09 0:14:03 vot[9750] VoiceOverTouch exiting because accessibility is not enabled. To enable do this: 'defaults write com.apple.Accessibility AccessibilityEnabled true' 12.08.09 0:14:03 Xcode[9079] Error launching simulated application: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 UserInfo=0x39251e0 "Unknown error."
Note that something called VoiceOverTouch
is mentioned in the log. My application does not contain (to the best of my knowledge) anything related to accessibility (could be brought in by some dependency though). I've enabled accessibility on my Mac as suggested in error message, but it did not helped. I've enabled Accessibility Inspector in the iPhone simulator. VoiceOverTouch message no longer appears in logs, but the Unknown error persists.
请注意,VoiceOverTouch
日志中提到了所谓的东西。我的应用程序不包含(据我所知)与可访问性相关的任何内容(尽管可能由某些依赖项引入)。我已按照错误消息中的建议在 Mac 上启用了辅助功能,但没有帮助。我在 iPhone 模拟器中启用了辅助功能检查器。VoiceOverTouch 消息不再出现在日志中,但未知错误仍然存在。
New logs:
新日志:
12.08.09 11:01:20 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.AXInspector[10808]) Exited: Terminated 12.08.09 11:01:28 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Unknown key for integer: JetsamPriority 12.08.09 11:01:28 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.apsd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory 12.08.09 11:01:28 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory 12.08.09 11:01:28 vot[10812] ******** AX INSPECTOR MODE ************ 12.08.09 11:01:28 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x2e9b930, has non-zero refcount = 1 12.08.09 11:01:28 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x495e240, has non-zero refcount = 1 12.08.09 11:01:28 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x2e9b930, has non-zero refcount = 1 12.08.09 11:01:28 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x495e240, has non-zero refcount = 1 12.08.09 11:01:28 Xcode[10200] Error launching simulated application: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 UserInfo=0x49b0060 "Unknown error." 12.08.09 11:01:29 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x44e4ba0, has non-zero refcount = 1 12.08.09 11:01:29 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x4537820, has non-zero refcount = 1 12.08.09 11:01:29 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x44e4ba0, has non-zero refcount = 1 12.08.09 11:01:29 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x4537820, has non-zero refcount = 1 12.08.09 11:01:29 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x4775400, has non-zero refcount = 1 12.08.09 11:01:29 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x478fa20, has non-zero refcount = 1 12.08.09 11:01:29 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x4775400, has non-zero refcount = 1 12.08.09 11:01:29 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x478fa20, has non-zero refcount = 1
回答by Alexander Gladysh
Recreating project step-by-step showed that it was directory structure.
一步一步重新创建项目显示它是目录结构。
I've had directory named 'resources'
with resources for my application. That directory was added to the bundle as is (via Folder References
feature).
我已经'resources'
为我的应用程序设置了以资源命名的目录。该目录按原样添加到包中(通过Folder References
功能)。
When I renamed that directory to less common name, error went away.
当我将该目录重命名为不太常见的名称时,错误消失了。
So, never name any custom directories in the bundle 'resources'
.
因此,永远不要在 bundle 中命名任何自定义目录'resources'
。
Guys from Xcode (or simulator) team could improve their error reporting. I've had to spend whole day debugging this issue. :-(
来自 Xcode(或模拟器)团队的人可以改进他们的错误报告。我不得不花一整天的时间来调试这个问题。:-(
回答by Teemu Kurppa
I just encountered similar error after cleaning up our XCode projects and updated them to use XCode config files. It occured only to one of our iPhone application targets, not all of them.
在清理我们的 XCode 项目并将它们更新为使用 XCode 配置文件后,我刚刚遇到了类似的错误。它只发生在我们的 iPhone 应用程序目标之一上,而不是全部。
XCode said
XCode 说
Error from Debugger: Failed to launch simulated application: Unknown error.
In Console, only information was following two lines:
在控制台中,只有以下两行信息:
30.9.2009 14.31.19 com.apple.launchd[99] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory
30.9.2009 14.31.19 Xcode[13827] Error launching simulated application: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 UserInfo=0x389db50 "Unknown error."
It turned out that I had accidentally deleted Info.list filebuild setting from the target and neither XCode nor iPhone simulator could emit any useful error message about that. Adding a build setting again fixed the problem.
结果是我不小心从目标中删除了Info.list 文件构建设置,XCode 和 iPhone 模拟器都无法发出任何有用的错误消息。再次添加构建设置解决了问题。
回答by Paul Cantrell
I had a similar issue with a different solution: some of my .xib files had a deployment target (2.0) that was no longer installed on my machine.
我在不同的解决方案中遇到了类似的问题:我的一些 .xib 文件的部署目标 (2.0) 不再安装在我的机器上。
The solution was to open the xibs in Interface Builder, do cmd-opt-I to get the project info for each one, and make sure the deployment and development targets were set to correct versions.
解决方案是在 Interface Builder 中打开 xib,执行 cmd-opt-I 以获取每个项目的项目信息,并确保将部署和开发目标设置为正确的版本。
I then did cmd-shift-K to clean the project in XCode, rebuilt, deployed, and everything seems to work fine.
然后我做了 cmd-shift-K 来清理 XCode 中的项目,重建,部署,一切似乎都正常。
回答by Robert Conn
Nothing above helped me - I went through all the suggestions. What eventually fixed it was deleting ~/Library/Application Support/iPhone Simulator. I then compiled and ran my app in the Simulator again, it recreated the directories, and my app ran fine. None of the accessibility or missing file errors were relevant.
以上都没有帮助我 - 我经历了所有的建议。最终修复它的是删除~/Library/Application Support/iPhone Simulator。然后我再次在模拟器中编译并运行我的应用程序,它重新创建了目录,我的应用程序运行良好。可访问性或丢失文件错误都无关紧要。
To add to the above, i've had to resort to just creating a new project in my latest version of the SDK (this problem only raised its ugly head when I upgraded to 3.1.3). I then had to copy all my source files and resources over and reconfigure the build settings etc. This seems to cure the problem but it was a bit of work!
为了补充上述内容,我不得不求助于仅在我最新版本的 SDK 中创建一个新项目(当我升级到 3.1.3 时,这个问题才变得丑陋)。然后我不得不复制我所有的源文件和资源并重新配置构建设置等。这似乎解决了问题,但它有点工作!
回答by Alex
I was getting this problem when I had my Info.plist file set to export to the target. You might want to check that, de-selecting that option fixed the problem for me.
当我将 Info.plist 文件设置为导出到目标时,我遇到了这个问题。您可能想检查一下,取消选择该选项为我解决了问题。
回答by Kay Siegert
After an update of the SDK I had the same problem. None of the tips worked for me. Finally I′ve noticed in the plist file there was a space character after ${EXECUTABLE_NAME} which caused the problem.
更新 SDK 后,我遇到了同样的问题。没有任何提示对我有用。最后我注意到在 plist 文件中 ${EXECUTABLE_NAME} 后面有一个空格字符导致了这个问题。
回答by Phil
I had a similar issue. I was also unable to install the app on a device, getting a 'The application bundle does not contain a valid identifier." error message. This was due to a directory named "Contents" added as a Folder Reference. I removed the reference, renamed the directory, add it again as a Folder Reference, clean the project, rebuild and voilà, I was able to launch the simulator.
我有一个类似的问题。我也无法在设备上安装应用程序,收到“应用程序包不包含有效标识符。”错误消息。这是由于名为“内容”的目录添加为文件夹引用。我删除了引用,重命名目录,再次将其添加为文件夹引用,清理项目,重建和瞧,我能够启动模拟器。
回答by Cliff McC
I use the Rename Project option to change my project's name and everything worked after that. I think we're all dancing around any number of methods of "fixing" whatever internal files XCode uses to track what it's doing. Pretty frustrating bug.
我使用重命名项目选项来更改我的项目名称,之后一切正常。我认为我们都在围绕任何数量的“修复”XCode 用来跟踪它正在做什么的内部文件的方法跳舞。相当令人沮丧的错误。
回答by Phil
Another reason for such an error message: a number in the executable file name (set in the projet plist file under "Executable file" key). The solution was to remove any number there, remove the application in the simulator, quit and relaunch xcode, rebuild, and tada, it's that simple :-(
出现此类错误消息的另一个原因:可执行文件名中的数字(在“可执行文件”键下的项目 plist 文件中设置)。解决方案是删除那里的任何数字,删除模拟器中的应用程序,退出并重新启动 xcode,重建和 tada,就这么简单:-(
回答by aepryus
For what it's worth, after reading this thread, I decided to just delete my targets and recreate them. Problem went away.
无论如何,在阅读此线程后,我决定删除我的目标并重新创建它们。问题消失了。
EDIT: After thinking I had finally found a way of working through this, I discovered I still had issues.
编辑:在认为我终于找到了解决这个问题的方法之后,我发现我仍然有问题。
The only surefire way I discovered to fix this issue is to create a new project from scratch. Then when adding new targets, rather than adding a new target, duplicate the existing target.
我发现解决这个问题的唯一可靠方法是从头开始创建一个新项目。然后在添加新目标时,不要添加新目标,而是复制现有目标。
One thing I have noticed is that if the Project and the Targets have the GCC 4.2 settings on their settings page than everything seems to work fine. If, however, those settings are missing and instead is a section called 'User-Defined' than all sorts of weird errors occur.
我注意到的一件事是,如果项目和目标在其设置页面上有 GCC 4.2 设置,那么一切似乎都可以正常工作。但是,如果缺少这些设置,而是一个名为“用户定义”的部分,则会发生各种奇怪的错误。
I have no idea whether those settings are a symptom or the source of the problem. I have also discovered no way to consistently get the settings page to switch.
我不知道这些设置是症状还是问题的根源。我还发现无法始终如一地切换设置页面。
One solution, that I have seen work sometimes (but, also seen not work many other times) is to switch the active target to Device while a device is plugged in. In certain cases this causes the correct settings to load. Then when you switch back to Simulator the correct settings are still there and everything seems to work fine.
一种解决方案,我有时看到有效(但也看到很多次无效)是在插入设备时将活动目标切换到设备。在某些情况下,这会导致加载正确的设置。然后当你切换回模拟器时,正确的设置仍然存在,一切似乎都正常。
I believe I have also noticed the following: My original project file had the GCC settings on the Project Settings page. One of the targets had the settings and worked, the other target didn't and didn't work. I deleted all of the targets and re-added two new targets. After this the GCC settings disappeared on the project settings page and were also absent from the settings pages of any targets that I created. Nothing I did could change that. Any of the targets I tried to install in the simulator result in the simulator showing a black screen with an error message simply saying failed to run in the simulator with an unknown error.
我相信我也注意到了以下几点:我的原始项目文件在项目设置页面上有 GCC 设置。其中一个目标进行了设置并正常工作,另一个目标没有也没有工作。我删除了所有目标并重新添加了两个新目标。在此之后,GCC 设置在项目设置页面上消失了,并且也没有出现在我创建的任何目标的设置页面中。我所做的一切都无法改变这一点。我尝试在模拟器中安装的任何目标都会导致模拟器显示黑屏和错误消息,只是说无法在模拟器中运行并出现未知错误。
Attempting to run those same targets on the device failed instantly without ever even attempting to compile (even after cleaning all targets) with an error saying something about invalid file.
尝试在设备上运行这些相同的目标会立即失败,甚至没有尝试编译(即使在清理所有目标之后),并显示有关无效文件的错误。
I'd really love to know what's going on, but after 6 hours of no progress, I gave up and simply recreated the project and the targets as described above and everything works fine.
我真的很想知道发生了什么,但是在 6 个小时没有进展之后,我放弃了,只是重新创建了上述项目和目标,一切正常。