我的 macOS 应用程序经过代码签名并在某些计算机上运行,但在另一台计算机上运行失败,因为 Gatekeeper 弹出“{App} 无法打开,因为无法确认开发者的身份。”
我想在发布错误的 .dmg 之前在构建机器上检测到这个问题,所以我查看了 Apple 的关于Checking Gatekeeper Conformance and Examining a Code Signature的文档,其中讨论了codesign
、spctl
和check-signature
. 令人困惑的是,所有这些工具都报告说 .app 是由我的开发者帐户签名的。
$ codesign -v --strict --deep --verbose=2 App.app
App.app: valid on disk
App.app: satisfies its Designated Requirement
$ codesign -d --deep --verbose=2 -r- App.app
Executable=/Applications/App.app/Contents/MacOS/App
Identifier=com.example.app
Format=app bundle with Mach-O thin (x86_64)
CodeDirectory v=20200 size=196 flags=0x0(none) hashes=3+3 location=embedded
Signature size=8539
Authority=Developer ID Application: Company, Inc. (XXXXXXXXXX)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=Sep 22, 2016, 7:32:19 PM
Info.plist entries=21
TeamIdentifier=XXXXXXXXXX
Sealed Resources version=2 rules=12 files=10708
Nested=Frameworks/Squirrel.framework
Nested=Frameworks/App Helper NP.app
Nested=Frameworks/App Helper.app
Nested=Frameworks/App Helper EH.app
Nested=Frameworks/Mantle.framework
Nested=Frameworks/ReactiveCocoa.framework
Nested=Frameworks/Electron Framework.framework
Internal requirements count=1 size=172
designated => identifier "com.example.app" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = XXXXXXXXXX
$ spctl --assess -vv App.app
App.app: accepted
source=Developer ID
origin=Developer ID Application: Company, Inc. (XXXXXXXXXX)
$ check-signature App.app
(c) 2014 Apple Inc. All rights reserved.
YES
Certificates, Identifiers & Profiles 网站在我的帐户下显示未过期的“Developer ID Application”和“Developer ID Installer”证书。我从未撤销过任何 Mac 签名证书。我还检查CFBundlePackageType
了应用程序的 Info.plist 是否设置为APPL
.
这里发生了什么?
更新:将 Mac 从 El Capitan 升级到 Sierra 解决了这个问题。如果有用户遇到它,我仍然有兴趣了解问题可能是什么。