Codesign返回1(对象ifile格式无效或不适合)错误 [英] Codesign returned 1 (object ifile format invalid or unsuitable) bug

查看:288
本文介绍了Codesign返回1(对象ifile格式无效或不适合)错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode 4.1 build 4B110f试图让我的iOS应用程序准备好上传。它通过了Product | Archive步骤,没有任何错误,要求两次获得签名的权限。但是当我尝试从管理器验证存档时,它会失败:

I'm working with Xcode 4.1 build 4B110f trying to get my iOS app ready for upload. It passes the Product|Archive step with no errors, asking twice for permission to sign something. But when I try a validate of the archive from the Organizer, it fails:

### Codesigning '/Users/uqrchern/Library/MobileDevice/Provisioning Profiles/70D2381D-3733-4F5D-88B2-4729572C2864.mobileprovision' with 'iPhone Distribution: Ron Chernich'
+ /usr/bin/codesign --force --preserve-metadata --sign iPhone Distribution: Ron Chernich --resource-rules=/var/folders/ul/ula1AHKnGpqQ9ftDnUL-l++++TM/-Tmp-/rybczU3EBd/Payload/ABRA-D.app/ResourceRules.plist --entitlements /var/folders/ul/ula1AHKnGpqQ9ftDnUL-l++++TM/-Tmp-/rybczU3EBd/entitlements_plistrZ1Vwko6 /var/folders/ul/ula1AHKnGpqQ9ftDnUL-l++++TM/-Tmp-/rybczU3EBd/Payload/ABRA-D.app
Program /usr/bin/codesign returned 1 : [/var/folders/ul/ula1AHKnGpqQ9ftDnUL-l++++TM/-Tmp-/rybczU3EBd/Payload/ABRA-D.app: replacing existing signature
/var/folders/ul/ula1AHKnGpqQ9ftDnUL-l++++TM/-Tmp-/rybczU3EBd/Payload/ABRA-D.app: object file format invalid or unsuitable
]
error: codesign failed with error 1

我看过所有类似的问题和解决方案(其中一些没有任何意义,或者适用于真正旧版本的工具)。没有任何差别。

I've looked at all the similar problems and solutions (some of which make no sense whatever, or apply to really old versions of the tools). None have made the slightest difference.

我还检查了3次验证使用生产证书,生成档案的代码签名步骤也是如此。我甚至把上面的输出变成了一个schell脚本,所以我可以手动尝试所有的证书:每次都有相同的结果。

I've also checked 3 times that verify is using the "production" certificate, as is the codesign step that produces the archive. I've even turned the above output into a schell script so I could try all certificates manually: same result every time.

也许签名的.app文件真的不合适?

Maybe the .app file being signed really is unsuitable?

顺便提一下,codesign没有版本标志,但是手册页的日期是2006年6月1日。二进制文件的文件日期是2010年11月20日。

Incidentally, codesign has no version flag, but the man page is dated June 1 2006. The binary has a file date of Nov 20 2010.

更新(第二天):

研究问题进一步发现了一个模糊的参考文献,称代码需要以下环境变量集:

Researching the problem further found an obscure reference saying that codesign needs the following environment var set:

CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate

使用失败的Validate运行的输出,我创建了一个shell脚本,它在失败的codeign之前导出了这个var --force step和中提琴!代码签名有效。

Using the output from a failed Validate run, I created a shell script which exported this var just before the failing codesign --force step and viola! The codesign works.

但这并不能帮助我准备上传代码。有没有办法将这个包含在由管理器验证按钮运行的脚本中?

But this does not really help me prepare my code for upload. Is there a way to include this into the script run by the Organizer Validate button??

稍微还有一点,解决方案! :

根据理论,有一个脚本可以生成在管理器验证期间运行的所有命令...运行,我用grep进行了一些挖掘找。该脚本确实存在,它的名字是:

Under the theory there is a script someplace which generates all the commands run during an Organizer Validate... run, I did some digging with grep and find. The script indeed exists and it's name is:

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication

它只是Perl,修复方法是将所需的环境变量添加到关联数组%ENV中开始,比如第72行:

It's just Perl and the fix is to add the required environment var to the associative array %ENV right at the start, say at line 72:

$ENV{CODESIGN_ALLOCATE} = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate';

这完全解决了这个问题。 我不知道网上所有其他海报认为他们通过删除证书,构建清理,关闭和重新启动Xcode等组合来修复它的地方来自。我只是默默地断言,这个修复偏爱科学而不是迷信,并且在Xcode 4.1 Build 4B110f及其相关的PackageApplication脚本下运行,在Snow Leopard 10.6.8下使用Perl 5.10.0运行

推荐答案

这样就可以从未答复的列表中删除。就像你说的,你需要将 CODESIGN_ALLOCATE 添加到 $ ENV 数组中:

Just so that this can be taken off the unanswered list. Like you said, you need to add CODESIGN_ALLOCATE to the $ENV array:

$ENV{CODESIGN_ALLOCATE} = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate';

如果每个人都在这里达成一致,我认为这个问题最终会被关闭。

If everyone is in agreement here, I think this question can finally be closed.

使用更新版本的Xcode时,默认位置为:

$ENV{CODESIGN_ALLOCATE} = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate';

这篇关于Codesign返回1(对象ifile格式无效或不适合)错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆