无效的可执行文件大小-从iTunes Connect [英] Invalid Executable Size - From iTunes Connect

查看:190
本文介绍了无效的可执行文件大小-从iTunes Connect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的iOS应用程序上传到iTunes.我正在使用MonoTouch编译我的iOS LibGdx游戏.在Android中几乎没有7-8mb.但是,当我在iTunes AppStore上上传时,它达到了78 mb.我不知道为什么?请让我知道.

I am uploading my iOS application on iTunes. I am using MonoTouch for compiling my LibGdx Game for iOS. In Android it is hardly 7-8mb. But When I upload on iTunes AppStore then its goes to 78 mb. I dont know why ? Please Let me know.

我也从Apple收到了此错误.

I have also received this error from Apple.

亲爱的开发人员,

我们发现您最近为"Run Panda Run:Racing"交付的一个或多个问题.要处理您的交货,必须更正以下问题:

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

无效的可执行文件大小-可执行文件大小为72037504字节超过了允许的最大大小60 MB.

Invalid Executable Size - The executable size of 72037504 bytes exceeds the maximum allowed size of 60 MB.

推荐答案

在没有更多详细信息的情况下很难给出确定的答案.有很多事情会影响应用程序的大小.让我们从基本开始.

It's hard to give a definite answer without more details. There's a lot of things that can affect the size of the applications. Let's start with the basic.

您应检查的内容:

  • First, ensure that your application is not being build with Don't link. That will create very big applications since you'll be AOT'ing nearly the full .NET framework that Xamarin.iOS ships;

第二,确保您要针对单一体系结构(ARMv7)进行构建. FAT二进制文件(例如ARMv7和ARMv7s)生成两次,并且需要两倍的空间;

Second, make sure you're building for a single architecture (ARMv7). FAT binaries (e.g. ARMv7 and ARMv7s) are build two times and needs twice the space;

第三,确保您尚未启用 Debug 构建(可以在Release build中启用,这是一个复选框).这将创建更大的二进制文件以支持调试;

Third make sure you have not enabled the Debug build (it's possible to do so in Release build, it's a checkbox). That will create larger binaries to support debugging;

第四项,确保您使用的是 LLVM 编译器.编译需要花费更多时间,但会生成更好(和更小)的代码;

Fourth make sure you're using the LLVM compiler. It takes more time to compile but it generates better (and smaller) code;

这些初始检查非常容易,并且是获得非常大的二进制文件的最常见原因.

Those initial checks are pretty easy to do and are the most common reasons for getting very large binaries.

要了解大小的来源,您需要了解应用程序的构建方式.

To understand where the size come from you need to know how the application are built.

  • Android版本和iOS版本之间的主要区别是,iOS(Apple的规则)不允许进行JIT(即时编译).

  • The main difference between the Android and iOS version is that JIT'ing (just-in-time compilation) is not allowed on iOS (Apple's rules).

这意味着代码必须经过AOT处理(提前编译),并且该过程将创建更大的可执行文件(因为IL比本机代码更紧凑);

That means the code must be AOT'ed (ahead-of-time compilation) and that process creates much larger executables (because IL is way more compact than native code);

如果您的代码是泛型代码,那么最终的二进制代码可能会变得非常大,因为它将需要本机编译所有泛型代码(可以共享许多情况,但不能共享值类型).

If your code is generic-heavy then the final binary can get quite large since it will need to natively compile every generic possibilities (many cases can be shared, but value-types cannot).

减小尺寸的方法:

  • 首先尝试减小您的托管代码大小.执行此操作的简单方法是在每个程序集上启用链接器,即在项目选项中链接所有程序集.
  • First try to reduce your managed code size. The easy way to do this is the enable the linker on every assemblies, i.e. Link all assemblies in your project options.

许多人认为不值得链接自己的代码-因为他们知道运行时将需要它(因此链接器无法删除它),否则他们将不会编写该代码.

Many people think it's not worth linking their own code - because they know it will be needed at runtime (so the linker cannot remove it) or else they would not have written that code.

这是正确的一半.链接器可能不能删除大多数应用程序代码,但是如果您使用的是第三方程序集,则不可能100%使用它们.链接器可以删除该多余的代码(也可以从SDK中删除保留为支持该不需要的代码的所有代码). 共享的代码越多,链接程序就可以为您提供更多帮助.

That's half true. The linker might not be able to remove most of your application code but if you're using 3rd party assemblies they are not likely 100% used. The linker can remove that extra code (and also remove, from the SDK, all the code that is kept to support that unneeded code). The more shared code you have the more the linker can help you.

更少的IL代码意味着更快的AOT时间,这转化为更快的构建更小的最终Binaire(包括可执行文件的大小).

Less IL code means faster AOT time, which translate to faster builds and smaller final binaires (including the executable size).

注意:关于如何控制链接器跳过某些程序集,某些类型或方法的处理/删除,有很多文档和博客条目.

Note: there's a lot of documents and blog entries on how you can control the linker to skip some assemblies, some types or method from being processed/removed.

  • 第二次尝试减小您的原生大小.如果您要构建本机库,请再看一遍,因为它们将静态(不是动态地)链接到最终二进制文件(iOS应用程序的另一条规则).在您的最终二进制文件中,其中一些可能不值钱(在功能方面)(也许有更轻的替代项).
  • Second try to reduce your native size. If you're building native libraries then have a second look at them as they will be statically (not dynamically) linked to your final binary (another rule for iOS applications). Some of them might not be worth (feature wise) their weight in your final binary (and there might be lighter alternatives).

这篇关于无效的可执行文件大小-从iTunes Connect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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