Codesign只有在其他xcode iphone项目成功签名后才能成功

发布于 2024-08-14 22:24:55 字数 1593 浏览 11 评论 0 原文

我有一个奇怪的问题。 Codesign拒绝签署我的这个大项目,项目A,但签署了另一个项目,项目B。但是,当我签署了项目B时,它突然也可以签署项目A。我 100% 确定我没有改变任何其他内容。我采取的步骤是:

尝试构建,签署 A - 签署失败
尝试构建,签署 B - 成功
尝试构建,签名 A - 成功

文字记录:

CodeSign build/Debug-iphoneos/CPPlayer.app
cd /Users/nick/CPPlayer
setenv CODESIGN_ALLOCATE /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/usr/bin/codesign -f -s "iPhone Developer: Nick Overdijk (PM7C8QKTYS)" --resource-rules=/Users/nick/CPPlayer/build/Debug-iphoneos/CPPlayer.app/ResourceRules.plist --entitlements /Users/nick/CPPlayer/build/CPPlayer.build/Debug-iphoneos/CPPlayer.build/CPPlayer.xcent /Users/nick/CPPlayer/build/Debug-iphoneos/CPPlayer.app

/Users/nick/CPPlayer/build/Debug-iphoneos/CPPlayer.app: object file format invalid or unsuitable
Command /usr/bin/codesign failed with exit code 1

在图片中: 请参阅此处 (imageshack gallery)

有什么我可能错过的吗?有什么想法怎么会发生这种情况吗?我现在一切正常,这似乎可以解决我的问题,但我想了解发生了什么。

有时它也像这样工作:
构建/签署 A - 成功
构建/签名 A - 失败
构建/签署 B - 成功(B 似乎总是成功)
构建/签署 A - 成功
构建/签名 A - 失败

因此,在每次成功构建 A 后,我必须构建并签名 B 才能再次签名项目 A。我可以连续重建项目 B 任意多次,它总是成功的。

我不确定这是否重要,而且当我尝试在模拟器中运行它(iPhone OS 3.1.2 的调试模式)时,它每次都无法安装。所以:

构建/运行 - 失败
构建/运行 - 有效
构建/运行 - 失败
构建/运行 - 有效

这仅适用于项目 A,我可以根据需要多次构建和运行项目 B,我从未收到安装失败的消息。

预先感谢,
缺口

I have a weird issue. Codesign refuses to sign this big project I have, project A, but does signs the other, project B. However, when I have signed project B, it also can sign project A all of a sudden. I am 100% certain I didn't change anything else. The steps I took were:

Try to build, sign A - fails on signing
Try to build, sign B - succeeds
Try to build, sign A - succeeds

Transcript:

CodeSign build/Debug-iphoneos/CPPlayer.app
cd /Users/nick/CPPlayer
setenv CODESIGN_ALLOCATE /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/usr/bin/codesign -f -s "iPhone Developer: Nick Overdijk (PM7C8QKTYS)" --resource-rules=/Users/nick/CPPlayer/build/Debug-iphoneos/CPPlayer.app/ResourceRules.plist --entitlements /Users/nick/CPPlayer/build/CPPlayer.build/Debug-iphoneos/CPPlayer.build/CPPlayer.xcent /Users/nick/CPPlayer/build/Debug-iphoneos/CPPlayer.app

/Users/nick/CPPlayer/build/Debug-iphoneos/CPPlayer.app: object file format invalid or unsuitable
Command /usr/bin/codesign failed with exit code 1

In pictures: See here (imageshack gallery)

Is there anything I could've missed? Any ideas how this can happen? I got everything working now and this seems a cure for my problem, but I'd like to understand what is happening.

Sometimes it also works like this:
Build/sign A - succeeds
Build/sign A - fails
Build/sign B - succeeds (B always seems to succeed)
Build/sign A - succeeds
Build/sign A - fails

So, after every successful build of A, I have to build and sign B to be able to sign project A again. I can rebuild project B any number of times in succession, it always succeeds.

I'm not sure if it matters, but also when I try to run it in the simulator (debug mode for iPhone OS 3.1.2) it fails to install each other time. So:

Build/run - Fails
Build/run - Works
Build/run - Fails
Build/run - Works

This goes only for Project A, I can build and run project B as many times as I like, I never get the message that the installation failed.

Thanks in advance,
Nick

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

悸初 2024-08-21 22:24:55

问题可能是 info.plist 文件太多。

我遇到了同样的问题(交替协同设计成功和失败)。

我已经在我的项目中添加了一个源代码目录,目录上有“添加现有文件”。结果目录中有一个 info.plist 文件,所以我的项目中现在有两个文件。我删除了新的并将其从项目中删除,我的问题就解决了。

The problem could be too many info.plist files.

I had the same problem (alternating codesign success and failure).

I had added a directory of source code to my project, with "add existing files" on the directory. Turns out there was a info.plist file in the directory, so I now had 2 of them in my project. I deleted the new one and removed it from the project, and my problem was solved.

南渊 2024-08-21 22:24:55

我还遇到了“Command /usr/bin/codesign failed with exit code 1”错误消息。

这是我解决它的方法

右键单击 info.plist 查看它的目标。确保左侧的框未选中。这是默认状态。

定位文件对于 info.plist 来说效果不佳。

I also was struggling with the 'Command /usr/bin/codesign failed with exit code 1' error message.

Here is how I solved it

Right-click on info.plist look at it's targets. Make sure the box to the left is UNCHECKED. This is the default state.

Targeting the files don't work fine for the info.plist.

萌吟 2024-08-21 22:24:55

搜索特定的错误消息

object file format invalid or unsuitable

我得到了这些链接:

http://www.galloway.me.uk/2009/04/json-framework-codesign-object-file-format-invalid-or-unsuitable/

这表明您的ResourceRules.plist 设置不正确。该解决方案似乎帮助了很多人解决了这个问题。

Searching for the specific error message

object file format invalid or unsuitable

I got these links:

http://www.galloway.me.uk/2009/04/json-framework-codesign-object-file-format-invalid-or-unsuitable/

which suggest that your ResourceRules.plist is not set up correctly. That solution seems to have helped a lot of folks with this problem.

寄风 2024-08-21 22:24:55

这个问题发生在我身上,尝试了证书、配置文件、清理和重新启动的所有组合,令人沮丧的是该死的系统没有告诉你问题是什么。让我继续猜测。我的解决方案是上面引用的文章。

“可执行文件名称”必须与“产品名称”匹配,这

确实让我在这里找到了这个。谢谢。

the issue happened to me, tried every combination of cert, provisioning profile, cleans and restarts, frustrating the damn system doesn't tell you what the issue is. just let me keep guessing. the solution for me was the above referenced article.

"Executable name" must match "Product Name"

really saved me to find this here. thanks.

行至春深 2024-08-21 22:24:55

确保您的目标中没有多个 Info.plist 文件!

Make sure you don't have more than one Info.plist file in your target!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文