xcode 无效签名 - 代码对象根本没有签名

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30653768/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:14:17  来源:igfitidea点击:

Invalid Signature - Code object is not signed at all

iosobjective-cxcodeapp-store-connect

提问by JAManfredi

Im able to submit my app through Xcode 6.3.2 perfectly fine. Validation and analyzing pass perfectly. Once it successfully submits to the app store though I get an email from Apple:

我可以通过 Xcode 6.3.2 完美提交我的应用程序。验证和分析完美通过。一旦它成功提交到应用商店,尽管我收到了一封来自 Apple 的电子邮件:

"Dear developer, We have discovered one or more issues with your recent delivery for "App". To process your delivery, the following issues must be corrected: Invalid Signature - Code object is not signed at all. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target. For more information, please consult https://developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.htmlOnce these issues have been corrected, you can then redeliver the corrected binary."

“亲爱的开发人员,我们发现您最近交付的“应用程序”存在一个或多个问题。要处理您的交付,必须更正以下问题: 无效签名 - 代码对象根本没有签名。请确保您已签署您的应用程序使用分发证书,而不是临时证书或开发证书。验证 Xcode 中的代码签名设置在目标级别是否正确(覆盖项目级别的任何值)。此外,请确保您上传的包是使用 Xcode 中的 Release 目标构建,而不是 Simulator 目标。如果您确定代码签名设置正确,请在 Xcode 中选择“Clean All”,在 Finder 中删除“build”目录,然后重建您的发布目标。了解更多信息,请咨询https://developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html一旦这些问题得到纠正,您就可以重新交付更正后的二进制文件。”

I have tried redownloading the distribution cert, regenerating the distribution provisioning profile, added "--deep" to the code signing "Other Code Signing Flags." I even checked the bundle name etc, everthing is alpha numeric. I was able to submit fine on May 22nd, now on June 3rd everything breaks.

我尝试重新下载分发证书,重新生成分发配置文件,将“--deep”添加到代码签名“其他代码签名标志”中。我什至检查了包名称等,一切都是字母数字。我能够在 5 月 22 日提交罚款,现在在 6 月 3 日一切都坏了。

Doesnt make any sense, any help would be appreciated!

没有任何意义,任何帮助将不胜感激!

UPDATE & SOLUTION:

更新和解决方案:

While I don't have a good explanation of why this suddenly has happened within the last week, I finally found a solution this morning.

虽然我无法很好地解释为什么这会在上周突然发生,但我今天早上终于找到了解决方案。

I started with a new project and submitted to the app store with nothing but the identifier and correct version and build numbers, which processed fine. After that I started piecing in any assets that wasnt my own code until I got the "Invalid Binary" email. I narrowed it down to the Hockey App SDK (embedded framework) which was causing the issue and not even being used anymore so I removed it from the project (problem solved). The disturbing part is that nothing fails on my end during validation or submission and according to github this directory and content hasn't changed in a year, which leads me to believe something changed server side at Apple.

我从一个新项目开始并提交到应用商店,除了标识符、正确的版本和内部版本号之外什么都没有,处理得很好。之后,我开始拼凑任何不是我自己代码的资产,直到我收到“无效的二进制”电子邮件。我将范围缩小到导致问题的 Hockey App SDK(嵌入式框架),甚至不再使用,因此我将其从项目中删除(问题已解决)。令人不安的是,在验证或提交过程中,我没有任何失败,而且根据 github,这个目录和内容在一年内没有改变,这让我相信 Apple 的服务器端发生了一些变化。

I did see a lot of posts via google saying that frameworks needed signed etc and when using Xcode 6 and iOS 8 it seems to be the standard which is why I assumed it might be something along these lines.

我确实通过谷歌看到很多帖子说框架需要签名等,当使用 Xcode 6 和 iOS 8 时,它似乎是标准,这就是为什么我认为它可能是这些方面的东西。

Im not sure how helpful this is as I was building for iOS and this article is in reference to Mac, but HockeyApp explains in order to distribute to the app store you need to sign the framework with your own identity here:

我不确定这有多大帮助,因为我是为 iOS 构建的,这篇文章参考了 Mac,但 HockeyApp 解释说,为了分发到应用商店,您需要在此处使用您自己的身份对框架进行签名:

http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x/hockeyapp-for-mac-os-x

http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x/hockeyapp-for-mac-os-x

If anyone has anymore technical notes on this or why this suddenly changed Id love to understand this better.

如果有人对此有更多技术说明,或者为什么这突然改变了,我很想更好地理解这一点。

回答by user503821

I've checked a variety of places and there seem to be several things that are now being rejected by iTunes Connect. The solution is typically to remove the offending resource from the Target -> Build Phases -> Copy Bundle Resources (as @azizus mentions). Unfortunately Apple doesn't tell you what file causes this issue with your builds so you have to go hunt for yourself. Here are some items that I've found that will do it:

我检查了很多地方,似乎有几件事现在被 iTunes Connect 拒绝了。解决方案通常是从 Target -> Build Phases -> Copy Bundle Resources(如@azizus 提到的)中删除有问题的资源。不幸的是,Apple 没有告诉您是什么文件导致您的构建出现此问题,因此您必须自己寻找。以下是我发现可以做到的一些项目:

  • Shell scripts (Look for .sh files, though they could have a different extension)
  • Also, look out for files that are listed as executable, when they shouldn't be. Those might be a good place to look for shell scripts that you might have missed.
  • Frameworks (Framework bundles, even .a or .o files - you don't need them as they will get compiled into the executable binary)
  • DocSets (I don't know why, but I found that the HockeyApp SDK includes a DocSet bundle which was the cause in my experience)
  • Sometimes this might also happen due to some weird entitlements issue. The entitlements you have may not match up with the App in the provisioning portal.
  • Look out for invalid characters in your app name or file names (like wildcard characters)
  • Shell 脚本(查找 .sh 文件,但它们可能具有不同的扩展名)
  • 另外,注意那些不应该被列为可执行文件的文件。这些可能是查找您可能错过的 shell 脚本的好地方。
  • 框架(框架包,甚至 .a 或 .o 文件 - 您不需要它们,因为它们会被编译成可执行的二进制文件)
  • DocSets(我不知道为什么,但我发现 HockeyApp SDK 包含一个 DocSet 包,这是我经验中的原因)
  • 有时这也可能由于一些奇怪的权利问题而发生。您拥有的权利可能与供应门户中的应用程序不匹配。
  • 注意应用名称或文件名中的无效字符(如通配符)

This is a pretty broad list, something I did to help in the search is build an archive and then show the contents of the .app in the archive using finder, sorting by file type. The strange thing is that these files actually exist in the _CodeSignature/CodeResources file.

这是一个相当广泛的列表,我在搜索中所做的一些事情是构建一个存档,然后使用 finder 显示存档中 .app 的内容,按文件类型排序。奇怪的是,这些文件居然存在于_CodeSignature/CodeResources文件中。

My own theory on why this is happening is that Apple made some changes (or is making some changes) because of Extensions and WatchKit apps. Essentially, you are including a couple of binaries in the packaged IPA (phone app, extension, watch app). They probably want to make sure you're not including something else that could potentially be executed. Unfortunately, the error message is too vague (really it's incorrect) for most.

我自己关于为什么会发生这种情况的理论是,由于扩展和 WatchKit 应用程序,Apple 进行了一些更改(或正在进行一些更改)。本质上,您在打包的 IPA(电话应用程序、扩展程序、手表应用程序)中包含了几个二进制文件。他们可能想确保您不包括其他可能被执行的内容。不幸的是,错误信息对大多数人来说太模糊了(实际上是不正确的)。

回答by villy393

This took me 3 days to debug.

这花了我 3 天的时间来调试。

In the end it was due to an external framework I created (lets call it X) that I was importing via carthage. X had its own dependencies that it was importing via carthage as well. In order to link these frameworks it had a path in the build settings called Framework Search Pathsset to the location of the frameworks. For some reason it was this flag in this framework that was causing the problem specified in the questions. I eventually imported X's dependencies with Git submodules so that I didn't have to set the Framework Search Pathsflag. I the exported the framework and manually added it to my project I was submitting to the AppStore. Then it worked.

最后,这是由于我创建的外部框架(我们称之为 X)是通过迦太基导入的。X 有它自己的依赖项,它也通过迦太基导入。为了链接这些框架,它在构建设置中有一个路径,称为Framework Search Pathsset 到框架的位置。出于某种原因,正是这个框架中的这个标志导致了问题中指定的问题。我最终使用 Git 子模块导入了 X 的依赖项,这样我就不必设置Framework Search Paths标志。我导出了框架并手动将其添加到我提交给 AppStore 的项目中。然后它起作用了。

回答by SilviaSantos

In my case it was a info.plist duplicated that was not used. (it wasn't easy find out the problem). I removed almost all the files of my project until remove this one and.. it worked

在我的情况下,它是一个未使用的 info.plist 重复。(找出问题并不容易)。我删除了我项目的几乎所有文件,直到删除了这个文件并且..它起作用了

回答by Paradise

Clearing the value for Code Sign Resource Rules Path in each target resolved the issue.

清除每个目标中代码签名资源规则路径的值解决了该问题。

回答by azizus

I contacted HockeyApp and they suggested not to add the SDK to app bundle. So I navigated to Target -> Build Phases -> Copy Bundle Resources and removed HockeySDKResources.bundle from there. iTunes Connect accepted my binary.

我联系了 HockeyApp,他们建议不要将 SDK 添加到应用程序包中。所以我导航到 Target -> Build Phases -> Copy Bundle Resources 并从那里删除了 HockeySDKResources.bundle。iTunes Connect 接受了我的二进制文件。