如何在 Xcode 上为第 3 方 CLI 协同设计和启用强化运行时?

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

How to codesign and enable the hardened runtime for a 3rd-party CLI on Xcode?

objective-cxcodemacoscodesignosx-gatekeeper

提问by SuperBerry

My project needs the Ghostscript to do lots of tasks, so I have added the gs CLI tool into my project resource. However when I tried to notarize the project application, Xcode shows me this:

我的项目需要 Ghostscript 来完成很多任务,所以我在我的项目资源中添加了 gs CLI 工具。但是,当我尝试对项目应用程序进行公证时,Xcode 向我显示:

enter image description here

enter image description here

I assume that might because the ghostscript portable CLI is a 3rd-party program from the internet and which doesn't have a codesign, also it has not been enabled the hardened runtime. On the latest MacOS Mojave I have to notarize applications to avoid the gatekeeper shows warnings during the user opens the DMG file. But it seems the notarizing is hard to pass if the application contains a 3rd-party CLI.

我认为这可能是因为 ghostscript 便携式 CLI 是来自 Internet 的第 3 方程序并且没有代码设计,也没有启用强化运行时。在最新的 MacOS Mojave 上,我必须对应用程序进行公证,以避免在用户打开 DMG 文件期间看门人显示警告。但如果应用程序包含第 3 方 CLI,则公证似乎很难通过。

Is there a solution for this?

有解决方案吗?

回答by SuperBerry

I found the solution finally. Sign the CLI this way:

我终于找到了解决方案。以这种方式签署 CLI:

codesign --force --options runtime --sign "Developer ID Application: COMPANYNAME" ./CLITool

Then I successfully archived the Application and uploaded to Apple to notarize.

然后我成功地将应用程序存档并上传到Apple进行公证。