xcode 如何为网守协同设计现有的 Mac OS X .app 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13204407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to codesign an existing Mac OS X .app file for gatekeeper?
提问by Troy
I paid the $99 to get a developer license w/ Apple. Installed Xcode 4.3. Went to the Organizer and "Provisioning Profiles" and refreshed to download my code signing certificate. Checked my Keychain Access and confirmed that I have "3rd Party Mac Developer ", "Developer ID" and "Mac Developer *" certificates.
我支付了 99 美元以获得 Apple 的开发者许可证。安装了 Xcode 4.3。转到组织者和“配置文件”并刷新以下载我的代码签名证书。检查了我的 Keychain Access 并确认我拥有“3rd Party Mac Developer ”、“Developer ID”和“Mac Developer *”证书。
At this point the documentation from apple mentioned pulling up your project files. I'm using Wineskin to package my Windows application, so I don't have an Xcode project. I have a .app file produced my Wineskin. I'd like to codesign the .app file that Wineskin produced for me.
此时,苹果的文档提到了提取您的项目文件。我正在使用 Wineskin 打包我的 Windows 应用程序,所以我没有 Xcode 项目。我的 Wineskin 有一个 .app 文件。我想对 Wineskin 为我生成的 .app 文件进行协同设计。
I tried: codesign -s "certificate name" /path/to/my.app
我试过: codesign -s "certificate name" /path/to/my.app
I tried all the possible certificate names that had my name and the word "Application" in them from my Keychain Access.
我从我的钥匙串访问中尝试了所有可能的证书名称,其中包含我的名字和“应用程序”一词。
Every time I get the error "/path/to/my.app: object file format unrecognized, invalid, or unsuitable"
每次我收到错误“/path/to/my.app: object file format unrecognized, invalid, or unsuitable”
Any idea on how to get past this error? Am I even attempting the proper command? Or is there a different way I should go?
关于如何克服这个错误的任何想法?我什至在尝试正确的命令吗?或者我应该采取不同的方式吗?
回答by Troy
To summarize the comments to my questions, here are the commands I run to sign my .app file for Gatekeeper:
总结对我的问题的评论,以下是我为 Gatekeeper 签署我的 .app 文件所运行的命令:
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"
codesign --force --sign "Developer ID Application: <my name>" /path/to/my.app
Thanks, Gordon Davisson and JWWalker!
谢谢,戈登戴维森和 JWWalker!
(edit) If this fails, I realize that installing the "Command Line Tools" from within XCode was needed.
(编辑)如果失败,我意识到需要从 XCode 中安装“命令行工具”。
EDIT:To verify
编辑:验证
$ codesign -dv --verbose=4 my.app
$ codesign -dv --verbose=4 my.app
In Apple ID account make sure you have few types of certificate?
在 Apple ID 帐户中确保您有几种类型的证书?
回答by asdf
Before using codesign command
使用 codesign 命令之前
Install Command line tool for Xcode from https://developer.apple.com/downloads/index.actionsection. (You should have a developer account to download Additional Tools.)
Please check for any hidden file in Payload folder like (.DStore) and if there is one please remove it
- Navigate to Payload folder via terminal using cdcommand
- Type ls- a command on terminal
- if there is any hidden file apart, delete it by rm -f .DStore
从https://developer.apple.com/downloads/index.action部分为 Xcode 安装命令行工具。(您应该有一个开发者帐户才能下载其他工具。)
请检查 Payload 文件夹中是否有任何隐藏文件,如 (.DStore),如果有,请将其删除
- 使用cd命令通过终端导航到 Payload 文件夹
- 在终端输入 ls - 命令
- 如果有隐藏文件分开,通过 rm -f .DStore 删除它
This solution worked for me so please give a try....
这个解决方案对我有用,所以请试一试....