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

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

问题描述

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

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.

这个错误是什么意思?

推荐答案

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

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).

造成这种情况的常见原因包括包缺少 Info.plist、包的 Info.plist 中缺少键或 Info.plist 中某些键的值不被允许.

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.

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

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.

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

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.

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

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.

Xcode 6.2 用户出现了此问题的较新实例.如果您的应用中捆绑了 WatchKit 应用扩展,它将无法安装到低于 iOS 8.2 的 iOS 模拟器运行时版本.作为一种解决方法,当您想要使用 iOS 8.1 和更早的运行时进行测试时,您需要手动禁止安装应用扩展.

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.

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

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.

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

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