iOS包大小的计算和优化

2,280 阅读2分钟

相关的几个概念

App thinning

Apple packages optimized, device-specific versions of your app via app thinning. What your users download only includes code and resources required by their specific device. You can generate an app size report using Xcode or look at the “App Store File Sizes” report in iTunes Connect to see what the actual initial download size of your app will be. Note that these figures represent the maximum amount that your users will download — see the application updates section of this page for more information on how updates are optimized.

CPU architectures

Our framework includes a “fat” (multi-architecture) binary that contains slices for armv7, arm64, i386, and x86_64 CPU architectures. ARM slices are used by physical iOS devices, while i386 and x86_64 are used by Simulator and are stripped from your app during the build and archive process. When a user downloads your app from the App Store, they receive only the architecture that their device requires.

Bitcode

Bitcode is included for ARM architectures but does not affect the final size of your application. Bitcode is an unoptimized intermediate code representation that is used by Apple for potential recompilation and re-optimization of your app binary, after App Store submission. As metadata solely intended for build optimization, bitcode is never downloaded by your users.

If you have disabled bitcode in your project, it is not necessary for you to remove bitcode from frameworks that contain it. Regardless of whether your app takes advantage of bitcode, the version of your app that the App Store delivers to your users never contains bitcode.

几篇相关文章

1.分别使用SDK和不包含SDK打包,用app_store_diff.sh脚本对比两次包大小的差异。 会在终端统计每一个framework的大小,最终输出传到apple store包的差异(只是预估的)。 github.com/predict-leg…

2.减少包大小apple官方文档 developer.apple.com/library/arc… 包括如何获得最终用户安装包的大小、每个环节产生包大小差异的原因、图片、代码、资源文件、音频文件减少包大小的一些建议。

3.减少升级包大小apple官方文档 developer.apple.com/library/arc… 这个事情主要是apple store去实现,这里只是简单介绍了一下原理。

4.hanson647.com/2018/05/30/… iOS包大小计算备忘