首页 文章

验证通过codesign,spctl和check-signature但未能运行的macOS应用程序“因为无法确认开发人员的身份”

提问于
浏览
6

我的macOS应用程序已经过编码并在某些计算机上运行但在另一台计算机上无法运行,因为Gatekeeper弹出“无法打开,因为无法确认开发人员的身份 . ”

我想在分发有故障的.dmg之前在构建机器上检测到这个问题,所以我查看了Apple的文档Checking Gatekeeper ConformanceExamining a Code Signature,其中讨论了 codesignspctlcheck-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

证书,标识符和配置文件网站显示我的帐户下未过期的"Developer ID Application"和"Developer ID Installer"证书 . 我've never revoked any Mac signing certificates. I' ve还检查了应用程序的Info.plist中的 CFBundlePackageType 设置为 APPL .

这里发生了什么?


Update: 将Mac从El Capitan升级到Sierra解决了这个问题 . 我仍然有兴趣了解在有用户遇到它的情况下可能出现的问题 .

1 回答

  • 3

    在我的情况下,当嵌入的第三方框架具有错误的运行路径设置时,出现了此消息:构建设置中的 LD_RUNPATH_SEARCH_PATHS 确实引用了不允许的内容 .

    Apple在此处提供此文件https://developer.apple.com/library/content/technotes/tn2206/_index.html#//apple_ref/doc/uid/DTS40007919-CH1-TNTAG207

    如果应用程序使用@rpath或绝对路径链接到应用程序外部的动态库,Gatekeeper将拒绝该应用程序 .

    他们甚至说:

    代码签名和spctl工具都不会显示错误 . 该错误仅出现在系统日志中 .

    解决方案是将第三方框架修改为标准,如下所示:

    $(inherited) @executable_path/../Frameworks @loader_path/Frameworks

相关问题