ios 无法在模拟器中运行应用程序:运行时遇到错误(域 = LaunchServicesError,代码 = 0)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25889189/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 02:31:33  来源:igfitidea点击:

Unable to run app in Simulator: An error was encountered while running (Domain = LaunchServicesError, Code = 0)

iosobjective-cxcode6

提问by Miki

After successfully compiling the project in Xcode 6, I am unable to run it in the simulator with the above mentioned message. I did all the possible research, tried everything and still no advances.

在 Xcode 6 中成功编译项目后,我无法使用上述消息在模拟器中运行它。我做了所有可能的研究,尝试了一切,但仍然没有进展。

I am not working with swift, neither I use widgets or extensions, so please do not suggest solutions caused by these as can be seen in similar questions.

我不使用 swift,也不使用小部件或扩展,所以请不要建议由这些引起的解决方案,如在类似问题中所见。

If someone found a possible cause (or solution!!) other than these, please help. Thanks

如果有人找到了除这些之外的可能原因(或解决方案!!),请提供帮助。谢谢

采纳答案by Miki

This has now been resolved. The problem was caused by ShareKit library added by CocoaPods for compatibility reasons. After removing the library and all related code, the app successfully launched in simulator. I recommend checking the system logfor more details on the issue as to me it pointed me in the right direction (stating the name of conflicting library).

现在已经解决了这个问题。该问题是由 CocoaPods 出于兼容性原因添加的 ShareKit 库引起的。删除库和所有相关代码后,应用程序在模拟器中成功启动。我建议检查系统日志以获取有关该问题的更多详细信息,因为它为我指明了正确的方向(说明冲突库的名称)。

回答by Sauvik Dolui

"Reset Content and Settings"from iOS Simutalormenu options and launching simulator after Quittingsolved my issue.

iOS Simutalor菜单选项中“重置内容和设置”并在退出后启动模拟器解决了我的问题。

Reset Content and Settings

重置内容和设置

回答by Hannes Lohmander

Cleaning the build folder resolved the issue for me. I hope it helps someone!

清理构建文件夹为我解决了这个问题。我希望它可以帮助某人!

(While holding down the Alt-key: Product > Clean build folder)

(同时按住Alt键:Product > Clean build folder

回答by A.G

I tried every other solution listed here. Well, I ported my project from Swift 1.2 to Swift 2.0. The application was stuck even after a lot debugging and launch services error 0 was reported.

我尝试了此处列出的所有其他解决方案。好吧,我将我的项目从 Swift 1.2 移植到 Swift 2.0。即使在报告了大量调试和启动服务错误 0 之后,该应用程序也卡住了。

solution: It happens because of framework compilation.

解决方案:这是由于框架编译而发生的。

App target -> Build Phases -> Embed Frameworks.

应用目标 -> 构建阶段 -> 嵌入框架。

So mark copy only when installing on. Clean the project and run it!

所以只在安装时标记副本。清理项目并运行它!

enter image description here

在此处输入图片说明

回答by JakubKnejzlik

In case anyone has this problem in combination with cocoa pods, these steps helped me to solve this error (after few hours):

如果有人将这个问题与可可豆荚结合使用,这些步骤帮助我解决了这个错误(几个小时后):

  • run pod cache clean
  • from SRC_ROOT run rm -rf Pods(optionally rm Podfile.lock)
  • Click on the Simulatorapp, click Simulator -> Reset Content and Settings...
  • Go into Xcode, In the Menu bar click Product -> Clean (or click Shift + Command + K).This will to clean your Xcode project.
  • Create a new Terminal Shell (From menu bar click Shell -> New Window)
  • run rm -rf ~/Library/Developer/Xcode/DerivedData/
  • pod cache clean
  • 从 SRC_ROOT 运行rm -rf Pods(可选rm Podfile.lock
  • 单击模拟器应用程序,单击模拟器 -> 重置内容和设置...
  • 进入 Xcode,在菜单栏中单击 Product -> Clean(或单击 Shift + Command + K)。这将清理您的 Xcode 项目。
  • 创建一个新的终端外壳(从菜单栏中单击外壳 -> 新窗口)
  • rm -rf ~/Library/Developer/Xcode/DerivedData/

...then try to Build & Run your project.

...然后尝试构建并运行您的项目。

Note:SRC_ROOT can be found by entering the Navigator, clicking on the project, clicking on the project again from the project and targets list, going into Build Settings, scrolling all the way to the bottom to the User-Defined Section, and the SRC_ROOT will be labeled as PODS_ROOT. Take that and copy it verbatum into the Terminal and proceed with step 2 from the list above.

注意:SRC_ROOT 可以通过进入Navigator找到,点击项目,从项目和目标列表中再次点击项目,进入Build Settings,一直滚动到底部到User-Defined Section,和 SRC_ROOT将被标记为 PODS_ROOT。将其逐字复制到终端中,然后继续执行上面列表中的第 2 步。

Hope it helps.

希望能帮助到你。

回答by Dharmbir Singh

I get rid from the issue by the given steps for simulator

我通过模拟器的给定步骤摆脱了这个问题

1. Way

1.方式

  1. Reset Content and Settings of Simulator.
  2. Clean your project by Cmd+Shift+K.
  3. Clear your Derived Data.
  4. The last one which is more important change your Bundle Identifier by "com.yourcompanyname.projectname"like "com.facebook.Facebook"
  1. 重置模拟器的内容和设置。
  2. 通过Cmd+Shift+K清理您的项目。
  3. 清除您的派生数据
  4. 最后一个更重要的是通过“com.yourcompanyname.projectname”更改您的捆绑标识符,例如“com.facebook.Facebook”

2. Way

2种方法

You can do only be the given line, it works for me

你只能做给定的行,它对我有用

The last one which is more important change your Bundle Identifier by "com.yourcompanyname.projectname"like "com.facebook.Facebook"

最后一个更重要的是通过“com.yourcompanyname.projectname”更改您的捆绑标识符,例如“com.facebook.Facebook”

Thanks and enjoy programming.

感谢并享受编程。

回答by Azin Mehrnoosh

Might be related to this issue: "This app contains an app extension with an illegal bundle identifier" issue

可能与此问题有关:“此应用包含具有非法捆绑标识符的应用扩展”问题

I had to format the bundle identifiers for my app and extension as follows:

我必须按如下方式格式化我的应用程序和扩展程序的包标识符:

com.company.AppName
com.company.AppName.Extension

回答by Chathurka

  1. First "Reset Content and Settings"
  2. If you didn't fill the build number and fill it and Run.
  1. 首先“重置内容和设置”
  2. 如果您没有填写内部版本号,请填写并运行。

It's solved for me.

已经为我解决了。

回答by charles

If you change the name of the supplied class InterfaceControllerset by default when you start a new project. This class is referenced in the Info.plistunder the key RemoteInterfacePrincipalClass. In my case, I got the error mentioned by the OP until I fixed the name of the class in there (see screenshot).

如果InterfaceController在启动新项目时更改默认设置的提供类的名称。此类Info.plist在 key 下引用RemoteInterfacePrincipalClass。在我的情况下,我收到了 OP 提到的错误,直到我在那里修复了类的名称(见截图)。

Info.plist: set principal class

Info.plist:设置主体类

回答by insanoid

If you are here after having issues doing an integration with WatchOS 2.0, go to - ~/Library/Logs/CoreSimulator/[Device UDID]/system.logand if says something like WatchKit 2 app has frameworks; that's not allowed.then follow the link below.

如果您在与 WatchOS 2.0 集成时遇到问题后来到这里,请转到 -~/Library/Logs/CoreSimulator/[Device UDID]/system.log如果说类似的WatchKit 2 app has frameworks; that's not allowed.话,请点击下面的链接。

http://zyafa.me/blog/watchos-2-and-embedded-frameworks

http://zyafa.me/blog/watchos-2-and-embedded-frameworks