Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An error was encountered while running (Domain = LaunchServicesError, Code = 0) [duplicate]

I received an error (Domain = LaunchServicesError, Code = 0) when trying to launch my app in the iOS Simulator with Xcode 6. I looked for solution in google, but I didn't find anything practical.

What does this error mean?

like image 336
Liran Revivo Avatar asked Sep 02 '14 21:09

Liran Revivo


1 Answers

This error indicates that there was a problem with installation. Unfortunately, Xcode does not actually print the contents of the error message that would give you more insight, but you can look at ~/Library/Logs/CoreSimulator/CoreSimulator.log to see the rest of the error details. There will also be more information about the problem in the simulated device's system log (~/Library/Logs/CoreSimulator/[Device UDID]/system.log); look for messages from installd around the time of the error).

Common causes for this include bundles missing an Info.plist, missing keys within your bundle's Info.plist, or values for some keys in the Info.plist not being allowed.

If your app's Info.plist does not contain a valid CFBundleVersion key/value pair, it is possible that your app may install correctly the first time but fail to update. Many users seem to work around this by doing a "Reset Contents & Settings" after each install, but it would be better to fix the root cause by setting an appropriate CFBundleVersion in the Info.plist. I believe iOS 8.2 now correctly returns an error on the first install in this case rather than just on updates, so hopefully this problem will be more obvious now.

Users with home directories on file systems that do not support hard links (eg: network home directories via AFP, SMB, or some NFS servers) may also run into problems related to hard linking. If this is the case, I suggest you create a path on your local HFS+ filesystem for simulator development (eg: /var/simulator/[user]) and create a symlink to that path from ~/Library/Developer/CoreSimulator. This particular issue was fixed in one of the iOS 8.2 betas.

In another case, the Build&Run would always succeed on the first try, but subsequent attempts would sometimes fail due to a changed Info.plist (eg: because someone's build system settings result in CFBundleVersion being different on each iteration). You can usually recover by either deleting the installed app (using a long-press from the home screen or xcrun simctl uninstall [Device UDID] [app identifier]) or erasing the device back to a default state. To erase the device, execute xcrun simctl erase [Device UDID] from terminal or choose Erase Contents & Settings from the iOS Simulator menu. This particular issue was fixed in one of the iOS 8.2 betas.

A newer instance of this issue is occurring for Xcode 6.2 users. If you have a WatchKit App Extension bundled in your app, it will fail to install to versions of the iOS Simulator runtime older than iOS 8.2. As a workaround, you will need to manually disable the app extension from installing when you want to test with iOS 8.1 and earlier runtimes.

If you need more specific help, please provide the entirety of the error message from CoreSimulator.log and any messages from installd and CoreSimulatorBridge that appear around the same time in ~/Library/Logs/CoreSimulator/[Device UDID]/system.log as that will reveal the underlying problem.

like image 73
Jeremy Huddleston Sequoia Avatar answered Oct 02 '22 22:10

Jeremy Huddleston Sequoia