使用 Xcode 9 导出开发者 ID 签名的应用程序包

Exporting a Developer-ID-signed app bundle with Xcode 9

我正在尝试从 Xcode 9.1 上的机器人中的 post-build 触发器导出 Developer-ID 签名的应用程序包,但我无法让它通过Gatekeeper 无需使用右键单击 Finder 解决方法。

按照 的建议,我尝试了 运行 codesign -dvv /path/to/my.app 并且我得到了这个输出(服务器和团队 ID 已经 *'d out):

Executable=/path/to/my.app/Contents/MacOS/myapp
Identifier=com.abbey-code.myapp
Format=app bundle with Mach-O thin (x86_64)
CodeDirectory v=20200 size=29403 flags=0x0(none) hashes=911+5 location=embedded
Signature size=4630
Authority=Mac Developer: OS X Server (**********)
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=Nov 20, 2017, 5:48:21 PM
Info.plist entries=35
TeamIdentifier=**********
Sealed Resources version=2 rules=13 files=141
Internal requirements count=1 size=184

上面的答案表明我应该看到 Developer ID Certification Authority,但我只看到 "Mac Developer" 作为根权限。我正在使用这些参数调用 xcodebuild:

xcodebuild -verbose -exportArchive -exportOptionsPlist exportOptions.plist -archivePath, /path/to/xcarchive, -exportPath, /path/to/place/exported/appbundle

我的 exportOptions.plist 看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>method</key>
    <string>mac-application</string>
    <key>signingCertificate</key>
    <string>Developer ID Application</string>
    <key>signingStyle</key>
    <string>automatic</string>
</dict>
</plist>

我的机器人已登录我的开发者帐户,并设置为自动管理证书。我还尝试在服务器上启动 Xcode,登录我的帐户,下载 Developer ID 证书,然后单击编辑机器人 sheet 中的 "Add to Server" 按钮。

我做错了什么?

我的导出选项 plist 不正确。我能够成功使用以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>method</key>
    <string>developer-id</string>
    <key>signingStyle</key>
    <string>automatic</string>
</dict>
</plist>

我可以确认需要手动将 Developer ID 证书添加到 Bot 配置中的服务器才能正常工作。出于某种原因,它不会自动获取那个。