Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 如何从命令行为应用商店外部的Mac应用程序编码签名?_Macos_Code Signing - Fatal编程技术网

Macos 如何从命令行为应用商店外部的Mac应用程序编码签名?

Macos 如何从命令行为应用商店外部的Mac应用程序编码签名?,macos,code-signing,Macos,Code Signing,我已经按照苹果官方文档从Xcode GUI对我的应用程序进行了代码签名,它可以工作,即,spctl-a-v给了我: $ spctl -a -v HelloCodeSign.app HelloCodeSign.app: accepted source=Developer ID 但是,当使用codesign命令行工具对同一应用程序的干净版本进行代码签名时,我发现以下错误: $ codesign --force --sign "Developer ID Application: MyCompany,

我已经按照苹果官方文档从Xcode GUI对我的应用程序进行了代码签名,它可以工作,即,
spctl-a-v
给了我:

$ spctl -a -v HelloCodeSign.app
HelloCodeSign.app: accepted
source=Developer ID
但是,当使用codesign命令行工具对同一应用程序的干净版本进行代码签名时,我发现以下错误:

$ codesign --force --sign "Developer ID Application: MyCompany, Inc." -vv HelloCodeSign.app
HelloCodeSign.app: replacing existing signature
HelloCodeSign.app: code failed to satisfy specified code requirement(s)
尝试了许多教程和StackOverflow帖子,但没有一个有用

是否有关于如何从命令行对签名进行编码的分步说明?我认为苹果公司的CLI版本的详细说明与他们的GUI版本的工作流不一样:

我尝试使用以下技术说明:

“需求语法”部分似乎与上面的错误消息有关。但是,没有关于如何找出这些语法的值以用于特定应用程序的说明。所以它看起来没用

更新

我遵循以下技术说明:

并使用此命令深入查看错误:

$ codesign --verify -vvvv -R='anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.1] exists and (certificate leaf[field.1.2.840.113635.100.6.1.2] exists or certificate leaf[field.1.2.840.113635.100.6.1.4] exists)' /path/to/HelloCodeSign.app
/path/to/HelloCodeSign.app: valid on disk
/path/to/HelloCodeSign.app: satisfies its Designated Requirement
test-requirement: code failed to satisfy specified code requirement(s)
关于错误信息,技术说明上说:

This error indicates that the profile used to sign the app is missing its submission entitlement which can occur for example when a development Provisioning Profile is used to the sign the app instead of the intended distribution profile.
然而,我很确定我使用了正确的开发者ID来签署应用程序。那里只有一个应用程序ID和一个安装程序ID,我使用了前者

更新2

我参考了技术说明并检查了应用程序的签名:

$ codesign -dvvv HelloCodeSign.app
Executable=HelloCodeSign.app/Contents/MacOS/HelloCodeSign
Identifier=com.mycompany.HelloCodeSign
Format=bundle with Mach-O thin (x86_64)
CodeDirectory v=20200 size=233 flags=0x0(none) hashes=4+3 location=embedded
Hash type=sha1 size=20
CDHash=8ca384ad68378c9bcde24dc4c1778d36a0048362
Signature size=4318
Authority=Mac Developer: My TeamAgent (WB764F5QV6)
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=May 25, 2015, 5:00:53 PM
Info.plist entries=22
TeamIdentifier=BCB4VLKTK5
Sealed Resources version=2 rules=12 files=5
Internal requirements count=1 size=192

这些都是要求吗??我应该将它们添加到
--requirements
开关中吗?

您使用的是什么版本的Mac OS X?您的应用程序是否包含任何dylibs、frameworks或helper应用程序,这些应用程序应该在整个应用程序之前进行签名?@JWWalker我使用的是OS X 10.10.3,Xcode 6.3。我的应用程序是直接从Xcode项目向导生成的空应用程序,没有代码,也没有添加任何内容。