Non-public API 用法:该应用程序包含一个或多个损坏的二进制文件

Non-public API usage : The app contains one or more corrupted binaries

我真的很沮丧 iOS 应用程序新版本上传是怎么回事。这是故事。

2018 年 1 月 25 日,我们上传了新版本 3.3.27 内部版本号 1.0。成功处理并可在 test-flight 上进行测试。之后我们发现了一些问题,并在 2018 年 1 月 26 日 修复了它并上传了新版本 1.1,我们收到来自 iTunes Connect 的电子邮件说:

Dear developer,

We have discovered one or more issues with your recent delivery for "appname". To process your delivery, the following issues must be corrected:

Non-public API usage:

The app contains one or more corrupted binaries. Rebuild the app and resubmit.

If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed.

If you think this message was sent in error and that you have only used Apple-published APIs in accordance with the guidelines, send the app's nine-digit Apple ID, along with detailed information about why you believe the above APIs were incorrectly flagged, to email@apple.com. For further information, visit the

虽然我在上传成功之前验证构建:

当我上传应用程序时,我获得了以下成功:

在邮件中,我没有得到正确的信息,损坏的二进制文件或框架的名称是什么。我们使用什么方法 non-public 我们在 1 月 25 日之前上传了该应用程序的 100 秒更新版本,一切都很好并且可以接受。

然后我尝试了以下更改:

  1. 重建应用程序并再次提交获得相同的电子邮件。
  2. 卸载 Xcode9.2 并再次安装收到相同的电子邮件。
  3. 删除更改并再次上传内部版本号 1.0 收到相同的电子邮件。
  4. 更改 Mac 并尝试在同一电子邮件中再次上传新版本。
  5. 尝试上传之前和同一个 emai 一起使用的旧版本

我们向 iTunes Connect Review 发送了一封电子邮件,但 3 天后我们没有收到他们的任何回复。我做了研究,从 1 月 26 日开始,许多用户在提交申请时都遇到了这种问题。

如果有人知道过去或最近遇到过此类问题的解决方案,请帮助我们

这个问题没有一个解决方案 Apple 现在在他们的官方帐户或论坛或他们的官方开发者网站上提到任何关于错误或无效二进制相关新闻的事情。即使他们不回复您的电子邮件。

一些通过 BitCode 启用解决了该问题,一些通过更新 PODFILE 解决了该问题,一些通过删除项目中使用的一些旧 swift 框架解决了该问题.

但最后我自己找到了适合我的解决方案。当我构建项目时,我在 Xcode 的左侧面板中发现了一些警告,如下所示。

我认为苹果现在删除了旧的 swift 支持,因此如果您的项目使用任何 swift class 或 podfile,我们需要更新到 swift 4.

一旦我转换为 swift 4,我会收到以下警告:

The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "appname" target.

为了修复此警告,我使用了以下 link The use of Swift 3 @objc inference in Swift 4 mode is deprecated? 并且在 swift class 中,我在 public 声明之前使用了 @objc。

我还检查了所有源代码并从项目中删除了未使用的 podfile 库和 class。

通过上述方式我解决了这个问题,在上传第 13 个版本后终于被接受了。

经过对这部分的大量调查,我们终于找到了这个问题的问题所在: 对于同时支持 32 位和 64 位的应用程序,Apple 似乎给出了这个错误。

Apple 对 Mac Appstore 进行了 this 提醒,但似乎 iOS 应用程序也受到了影响。

因此,一个解决方案是支持 bitcode 或通过从构建设置中删除对 ARMV7 和 ARMV7S 的支持或从 Valid Architectures 中删除对 32 位设备的支持。这意味着您的应用程序只能在 iPhone 5S 及更高版本上运行。 我希望这对某人有所帮助。

谢谢,祝编码愉快!

我们找到了 2 个问题的解决方案。删除上面提到的 32 位支持。并删除 CommonCrypto 的使用。我们用 CryptoSwift 替换了 CommonCrypto (https://github.com/krzyzanowskim/CryptoSwift)。

我们选择替换 CommonCrypto,因为我们不想失去我们的 32 位用户(iPhone4S、5 和 5C)。

非public API 是指Apple API 未记录和提供给程序员的方法。 Apple 不保证 API 的这一部分在未来的升级中有效。他们可以自由改变这部分。 它们禁止使用,这样您的应用就不会在 iOS 更新中中断,从而保护您应用的未来 users/buyers! Web 服务是外部的,因此不属于非 public。这部分你需要保证,不是苹果。