问题
- OS X 10.5.7 (genuine 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:
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.
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
A quote from the 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.
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
回答1:
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).
When I renamed that directory to less common name, error went away.
So, never name any custom directories in the bundle 'resources'
.
Guys from Xcode (or simulator) team could improve their error reporting. I've had to spend whole day debugging this issue. :-(
回答2:
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 said
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 file build 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.
回答3:
Looks like this is your key bit (doesn't normally come up in system log):
VoiceOverTouch exiting because accessibility is not enabled. To enable do this:
'defaults write com.apple.Accessibility AccessibilityEnabled true'
Your app has some dependency on accessibility being enabled. Suggest you follow the instruction and run the bit in quotes on your system console.
回答4:
I'm worried about these two lines:
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
It appears to me like your Xcode (specifically, the iPhone Simulator) installation is broken somehow. I'd suggest saving all your important files and reinstalling the SDK.
回答5:
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.
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.
I then did cmd-shift-K to clean the project in XCode, rebuilt, deployed, and everything seems to work fine.
回答6:
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.
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!
回答7:
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.
回答8:
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.
回答9:
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.
回答10:
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.
回答11:
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 :-(
回答12:
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.
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.
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.
回答13:
I believe that ultimately there are a spectrum of issues at play here. Some may be resolved by clean & rebuild, deleting preferences, etc.
None of these help resolve my issue.
I discovered that I had added some 3rd party code to my app that contained 1.) XIB files for their sample app and 2.) an info.plist file both of which erroneously had been added to my target.
Removing the XIB did not resolve the issue, but removing the info.plist file did.
Check your targets carefully and ensure that the assets that are being built and bundled are in fact needed.
回答14:
I had the same issue. I had a lite scheme and a full version scheme. Neither radio button was selected under Launch. I wish I had taken a screenshot when it was in this state. As soon as I clicked "Automatically" it worked just fine.
Seems like a pretty glaring issue with XCode 4.

回答15:
I had the same problem. Turned out the Info.plist was "missing" and had to be explicitly declared in the project settings. For some reason using the default name wasn't enough.
来源:https://stackoverflow.com/questions/1262898/failed-to-launch-simulated-application-unknown-error