xcode 为 iOS 9 启用 Bitcode 将 IPA 大小增加 3 倍,这是应用商店中的大小吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32745770/
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
Enabling Bitcode for iOS 9 increases IPA size 3x, is this the size on the app store?
提问by FrostRocket
Before iOS 9, our IPA size was roughly 6MB. After Archiving and exporting our IPA through Xcode 7, our IPA increased to about 17MB. Upon further investigation, we found out that enabling the "Bitcode" option in the export settings is what caused the large filesize jump.
在 iOS 9 之前,我们的 IPA 大小大约为 6MB。通过 Xcode 7 归档和导出我们的 IPA 后,我们的 IPA 增加到大约 17MB。经过进一步调查,我们发现在导出设置中启用“Bitcode”选项是导致大文件大小跳跃的原因。
My question is this: if we enable this option, will our IPA size be 17MB in the store? Or does Apple do something with the bundle to make it roughly the same size as before (6MB).
我的问题是:如果我们启用此选项,我们的 IPA 大小在商店中是否为 17MB?或者 Apple 是否对捆绑包进行了一些处理,使其大小与以前大致相同(6MB)。
There's not much info about Bitcode out there right now, and I'd like to be informed before submitting to the store. 6MB and 17MB is enough of a difference to be concerned.
目前关于 Bitcode 的信息不多,我想在提交到商店之前得到通知。6MB 和 17MB 的差异足以引起关注。
回答by Santosh Botre
Bitcode is an intermediate representation of a compiled program. Enabling it will increase the build (ipa) size on the developer front.
位码是已编译程序的中间表示。启用它会增加开发人员前端的构建 (ipa) 大小。
iOS can run on different CPUs (i386, x86_64, arm, arm64, etc.), if you want to run program on any iOS setup, then the program should contain object code for each platform. When you run a program, OS reads the ‘Table Of Contents' and looks for a slice corresponding to the OS CPU. For instance, if you run operating system on x86_64, then OS will load object code for x86_64 into a memory and run the program.
iOS 可以在不同的 CPU 上运行(i386、x86_64、arm、arm64 等),如果你想在任何 iOS 设置上运行程序,那么程序应该包含每个平台的目标代码。当您运行程序时,操作系统会读取“目录”并查找与操作系统 CPU 相对应的切片。例如,如果您在 x86_64 上运行操作系统,那么操作系统会将 x86_64 的目标代码加载到内存中并运行程序。
Currently, all the apps on the AppStore contain object code for arm and arm64 CPUs. Moreover, third-party proprietary libraries or frameworks contain object code for i386, x86_64, arm and arm64, so you can use them to test the app on device and/or simulator.
目前,AppStore 上的所有应用程序都包含 arm 和 arm64 CPU 的目标代码。此外,第三方专有库或框架包含 i386、x86_64、arm 和 arm64 的目标代码,因此您可以使用它们在设备和/或模拟器上测试应用程序。
How the Bitcode works? When you submit an app (including Bitcode) Apple's ‘BlackBox' recompiles it for each supported platform and drops any ‘useless' object code, so AppStore has a copy of the app for each CPU. When end user wants to install the app - she installs only version for particular processor, without any unused stuff.
比特码是如何工作的?当您提交应用程序(包括 Bitcode)时,Apple 的“BlackBox”会为每个支持的平台重新编译它并删除所有“无用”的目标代码,因此 AppStore 为每个 CPU 都有一个应用程序副本。当最终用户想要安装应用程序时 - 她只安装特定处理器的版本,没有任何未使用的东西。
Bitcode might save up to 50% of disk space per program.
Bitcode 最多可为每个程序节省 50% 的磁盘空间。
Refere: http://lowlevelbits.org/bitcode-demystified/
参考:http://lowlevelbits.org/bitcode-demystified/