为 OSX 10.9 签署框架 [英] Sign a Framework for OSX 10.9
问题描述
在使用 macdeployqt
后,我签署了我的应用程序以避免 Gatekeeper 问题.
After using macdeployqt
I sign my application to avoid Gatekeeper problems.
我可以在所有框架和捆绑包内的所有内容上使用 codesign
但当我签署捆绑包时出现错误:
I can use codesign
on all the frameworks and everything inside the bundle but when I come to sign the bundle I get an error:
$ codesign --force --verify --verbose --sign "Developer ID Application: My ID" MyApplication.app
MyApplication.app: bundle format unrecognized, invalid, or unsuitable
In subcomponent: /Users/username/Dev/Apps/MyApplication/MyApplication.app/Contents/Frameworks/QtConcurrent.framework
如果我检查签名:
$codesign -vvv MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent
MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent: valid on disk
MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent: satisfies its Designated Requirement
根据 http://furbo.org/2013/10/17/code-signing-and-mavericks/ 看来我应该像这样对框架包进行签名
According to http://furbo.org/2013/10/17/code-signing-and-mavericks/ it seems that I should sign the framework bundle something like this
$ codesign --force --verify --verbose --sign "Developer ID Application: My ID" MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Versions/5
但这会导致
MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Versions/5: bundle format unrecognized, invalid, or unsuitable
推荐答案
今天早上遇到了同样的错误.OSX 10.9 上的 codesign 应用程序似乎更严格
Got the same error this morning. The codesign application seems to be stricter on OSX 10.9
该问题是由于 macdeployqt 没有将 Qt 框架包的 info.plist 文件复制到应用包中造成的.
The problem is caused by macdeployqt not copying the Qt framework bundles' info.plist file into the app bundle.
您可以通过告诉脚本手动将文件复制到嵌入式框架的包文件中来解决此问题.
You can work around this problem by telling your script to copy the files manually into the embedded framework's bundle file.
例如
$ cp ~/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtCore.framework/Contents/Info.plist MyApplication.app/Contents/Frameworks/QtCore.framework/Resources/
在调用 macdeployqt* 之后,但在调用 codesign 之前,为您的应用程序使用的每个 qt 模块执行此操作.(* 或 mkdir 目标目录)
Do this for each of the qt modules your app uses, AFTER calling macdeployqt*, but BEFORE calling codesign. (* or mkdir the destination directories)
另外,在框架的文件夹上调用 codesign,而不是在版本子文件夹上.
Also, call codesign on the framework's folders, not on the version subfolder.
即
$ codesign --force --verify --verbose --sign "Developer ID Application: My ID" MyApplication.app/Contents/Frameworks/QtConcurrent.framework
希望这会有所帮助.
这篇关于为 OSX 10.9 签署框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!