Xcode 错误:无法启动

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

Xcode error: failed to launch

xcodeicloud

提问by user1103804

I have a Mac app I have written to support iCloud. However, I get this when trying to run the app:

我编写了一个 Mac 应用程序来支持 iCloud。但是,我在尝试运行应用程序时得到了这个:

error: failed to launch /Users/padsoftware/Library/Developer/Xcode/DerivedData/Scrawl-heofvoywsunchdhjowxkvkoiqvan/Build/Products/Release/Scrawl.app/Contents/MacOS/Scrawl

错误:无法启动/Users/padsoftware/Library/Developer/Xcode/DerivedData/Scrawl-heofvoywsunchdhjowxkvkoiqvan/Build/Products/Release/Scrawl.app/Contents/MacOS/Scrawl

The odd thing is that this appears for all of my Mac apps, with or without iCloud, with or without sandboxing, with or without entitlements, or ever with or without code signing. Any idea on how to fix this?

奇怪的是,这出现在我所有的 Mac 应用程序中,有或没有 iCloud,有或没有沙盒,有或没有权利,或者有或没有代码签名。关于如何解决这个问题的任何想法?

回答by Andy

I had this problem too. For me, it was a code sign issue. Make sure you're signing with developer, not distribution.

我也有这个问题。对我来说,这是一个代码签名问题。确保您与开发人员签署,而不是分发。

回答by an yu

I encounter this problem every once in a while. Like the others mentioned, these are the steps I take:

我每隔一段时间就会遇到这个问题。像其他人提到的一样,这些是我采取的步骤:

1. Clean (Shift+Cmd+K)------ Removes all the product files, as well as any object files (.o files) or other intermediate files created during the build process (Apple Doc)

1. Clean (Shift+Cmd+K)------ 删除所有产品文件,以及在构建过程中创建的任何目标文件(.o 文件)或其他中间文件(Apple Doc)

2. Navigate to "~/Library/Developer/Xcode/DerivedData", delete folder for app in question------ Derived data consists of project indexes, logs, and build products including intermediate files (Apple Doc)

2.导航到“~/Library/Developer/Xcode/DerivedData”删除有问题的应用程序的文件夹------派生数据由项目索引、日志和构建产品组成,包括中间文件(Apple Doc)

3. Restart Xcode

3.重启Xcode

One or the other usually fixes it. I haven't had to change Code Signing settings, but that would be my next step. Wouldn't re-install Xcode unless absolutely necessary.

一个或另一个通常会修复它。我不必更改代码签名设置,但这将是我的下一步。除非绝对必要,否则不会重新安装 Xcode。

回答by M.Othman

I had such problem also and restarting Xcode Fixed the issue .

我也有这样的问题,重新启动 Xcode 解决了这个问题。

even it happened after renaming the application ....

甚至在重命名应用程序之后发生了......

回答by Samatron

  1. Under Build Settings make sure you are signing with a valid developer profile for debug and release.
  2. Then Build for Testing
  1. 在构建设置下,确保您使用有效的开发人员配置文件进行签名以进行调试和发布。
  2. 然后构建以进行测试

That fixed the problem.

这解决了问题。

回答by gail

"Product"->"Scheme"->"New Scheme" fixed my problem

“产品”->“方案”->“新方案”解决了我的问题

回答by shreddish

What worked for me... I was already code signed as developer so I cleaned my code menu bar -> Product -> Clean

什么对我有用...我已经作为开发人员进行了代码签名,所以我清理了代码菜单栏 -> 产品 -> 清理

That still didn't fix it but I noticed that I was getting handshake error, I had a large amount of apps already running on my phone (~15-20) so I exited out of all of them and retried. It worked after exiting out of all other apps.

那仍然没有解决它,但我注意到我收到了握手错误,我的手机上已经运行了大量应用程序(~15-20),所以我退出了所有应用程序并重试。它在退出所有其他应用程序后工作。

回答by jowie

Just in case it helps anyone else, my problem was fixed by rebooting my iPhone (4S). Then the app suddenly appeared on the Springboard (it was like it was already installed but somehow hidden).

以防万一它对其他人有帮助,我的问题已通过重新启动 iPhone (4S) 解决。然后应用程序突然出现在 Springboard 上(就像它已经安装但不知何故隐藏了一样)。

...I did all the other steps (restart Xcode, clean project, delete derived data) but none of it worked this time.

...我做了所有其他步骤(重新启动 Xcode,清理项目,删除派生数据),但这次都没有奏效。