运行时遇到错误(Domain = LaunchServicesError,Code = 0) [英] An error was encountered while running (Domain = LaunchServicesError, Code = 0)

查看:143
本文介绍了运行时遇到错误(Domain = LaunchServicesError,Code = 0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Xcode 6在iOS模拟器中启动我的应用程序时收到错误(Domain = LaunchServicesError,Code = 0)。我在谷歌寻找解决方案,但我没有找到任何实用的。



这个错误是什么意思?

解决方案

此错误表示存在问题安装。不幸的是,Xcode实际上并不打印错误消息的内容,这会让你更深入了解,但你可以查看〜/ Library / Logs / CoreSimulator / CoreSimulator.log来查看其余的错误细节。在模拟设备的系统日志中还会有关于该问题的更多信息(〜/ Library / Logs / CoreSimulator / [Device UDID] /system.log);在错误发生时寻找来自installd的消息)。



这包括缺少Info.plist的捆绑包,捆绑包Info.plist中缺少密钥的常见原因,或者不允许Info.plist中某些键的值。



如果您的应用的Info.plist不包含有效的CFBundleVersion键/值对,则可能是您的应用程序可能第一次正确安装但无法更新。许多用户似乎通过在每次安装后执行重置内容和设置来解决此问题,但最好通过在Info.plist中设置适当的CFBundleVersion来解决根本原因。我相信iOS 8.2现在正确地在第一次安装时返回错误,而不仅仅是更新,所以希望现在这个问题会更加明显。



有家的用户不支持硬链接的文件系统上的目录(例如:通过AFP,SMB或某些NFS服务器的网络主目录)也可能遇到与硬链接相关的问题。如果是这种情况,我建议您在本地HFS +文件系统上创建一个用于模拟器开发的路径(例如:/ var / simulator / [user]),并从〜/ Library / Developer / CoreSimulator创建一个到该路径的符号链接。这个特殊问题在iOS 8.2测试版之一中修复。



在另一种情况下,Build& Run在第一次尝试时总会成功,但后续尝试有时会失败由于Info.plist的改变(例如:因为某人的构建系统设置导致CFBundleVersion在每次迭代时都不同)。您通常可以通过删除已安装的应用程序(使用长按主屏幕或 xcrun simctl uninstall [设备UDID] [应用程序标识符] )或删除设备来恢复回到默认状态。要删除设备,请从终端执行 xcrun simctl erase [Device UDID] 或选择删除内容& iOS模拟器菜单中的设置。此特定问题已在其中一个iOS 8.2测试版中修复。



Xcode 6.2用户正在出现此问题的较新实例。如果您的应用程序中捆绑了WatchKit App Extension,则无法安装到早于iOS 8.2的iOS Simulator运行时版本。作为一种变通方法,当您想要使用iOS 8.1及更早版本的运行时进行测试时,您需要手动禁用应用程序扩展。



如果您需要更具体的帮助,请提供来自CoreSimulator.log的完整错误消息以及来自installd和CoreSimulatorBridge的任何消息,这些消息大约同时出现在〜/ Library / Logs / CoreSimulator / [Device UDID] /system.log中,因为这将揭示潜在的问题。 / p>

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?

解决方案

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.

这篇关于运行时遇到错误(Domain = LaunchServicesError,Code = 0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆