Xcode成功构建但无法运行macOS应用 [英] Xcode successfully builds but fails to run macOS app

查看:314
本文介绍了Xcode成功构建但无法运行macOS应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个使用CloudKit的mac应用程序,自从升级到Sierra和XCode 8之后,该应用程序将成功构建,但是当我单击运行时,Xcode将不会启动该应用程序。

I've written a mac application that uses CloudKit, and ever since I've upgraded to Sierra and XCode 8, the app will successfully build, but Xcode will not launch the application when I click "run".

如果我进入Derived Data文件夹并手动双击应用程序以启动它,它将立即崩溃并在错误报告中显示以下内容:

If I go into the Derived Data folder and manually double-click my application to launch it, it crashes immediately and displays the following in the error report:

Time Awake Since Boot: 12000 seconds
Time Since Wake:       6500 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (Code Signature Invalid)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 0x1

有趣的是,如果我存档应用程序并导出开发人员ID签名的应用程序,导出的版本已成功签名并可以正常运行

What's interesting is, if I archive the app and export a Developer ID-signed application, the exported build is signed successfully and works perfectly.

此外,如果我进入功能选项卡并关闭iCloud功能,则该应用程序将成功在XCode中运行。

Additionally, If I go into the capabilities tab and toggle off the iCloud capability, the app successfully runs in XCode.

每当我在DerivedData文件夹中的应用程序上运行spctl时,无论是否启用或禁用iCloud,我总会得到以下信息:

Whenever I run spctl on the app in the DerivedData folder, whether or not I have iCloud enabled or disabled, I always get this:

spctl --assess --verbose=4 MyApp.app
MyApp.app: rejected

在XCode的常规选项卡中,将其设置为自动管理签名,据我所知,我所有的证书都是有效的。

In the General tab on XCode I've set it to "Automatically manage signing", and as far as I can tell, all of my certificates are valid.

不确定在这里做什么。我什至尝试完全禁用Gatekeeper,但仍然没有运气。

Not really sure what to do here. I've even tried disabling Gatekeeper completely and still no luck.

推荐答案

Aaaargh。找到了我的问题的答案,希望答案也能对您有所帮助。
我的代码签名已在开发目标中正确设置,但在测试目标中被临时签名。一旦为测试目标设置了配置文件,问题就消失了。

Aaaargh. Found the answer to my problem, I hope the answer may help you as well. My code signing was set up correctly in the development target, but it was ad hoc signed in the Test Target. As soon as I set up a profile for the Test target the problem went away.

这篇关于Xcode成功构建但无法运行macOS应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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