Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce app size in iOS?

I know it has been asked many times, but every answer suggests using compressed images or linking to images from the web instead of the resource bundle.
In my app there is only 1.5 MB of images, but still the app has a size of 20.9 MB.

The other files in my app are the following:

  • 2 frameworks (CoreLocation, CoreBluetooth)
  • 2 pods (Fabric, Crashlytics)
  • 8 xib
  • 2 fonts (254KB)
  • And some Swift and obj-c files

Could anyone help me optimize the size of my app?


I am wondering why my app is so large if there is only 1.5 MB of images and 254KB of fonts? I have some apps on my iPhone which have the same functionality as my app and they only take up 520 KB and 1.6 MB. Does anyone know how the developers of those apps achieved that?

like image 360
Mrugesh Tank Avatar asked Feb 06 '16 09:02

Mrugesh Tank


2 Answers

The Swift runtime is included with every app that is currently using Swift and inflates the app size. Apple doesn't promise code compatibility - but runtime compatibility is promised. In order to do that the Swift runtime libraries of your compiled code is included with the app. That takes up some space :)

like image 103
YogevSitton Avatar answered Sep 20 '22 04:09

YogevSitton


The App Store size might be smaller than Xcode reports. If you upload your build to TestFlight, TestFlight will report a much smaller size (but then tell you the regular App Store version might be larger). With app thinning and bitcode the size of the binary delivered to your user's phones will be smaller than the "full" app size.

Swift's overhead should go away once Swift 5 (https://github.com/apple/swift-evolution) gains ABI compatibility.

Fabric/Crashlytics add a few MB alone. If you build an Archive, then in Finder right-click on the the app and Show Package Contents. From there you can sort by file size and see the biggest culprits.

like image 34
Graham Perks Avatar answered Sep 20 '22 04:09

Graham Perks