Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce the package size of ML Kit iOS?

I developed an application to do the text recognition by using ML Kit iOS. I only need to recognise in English. Is it possible to reduce the size of the package. Currently it's over 300 MB.

like image 564
Bagusflyer Avatar asked Sep 02 '25 03:09

Bagusflyer


1 Answers

There are many different sizes to measure for a bundle. E.g. the bundle you upload to Apple has all 4 architectures of native code; but the actual served bundle to end user device only has 1 architecture. Another example is if you enable BitCode, the app bundle would appear much bigger locally, but the eventual downloaded size to end user device would be smaller (than wo/ Bitcode) and runs faster.

I'd recommend test for real served app size from App Store, e.g. via TestFlight.

Some numbers which I tried quickly, 1 architecture, wo/ Bitcode, 75MB for all Vision features ML Kit supports (you only need 1 of them, which is Text). 4 architectures is less than 200MB.

So some general suggestions: 1. Follow official documentation to configure only the Pods you require (instead of all Firebase). https://firebase.google.com/docs/ml-kit/ios/recognize-text#before-you-begin 2. Enable Bitcode 3. Measure real downloaded app bundle size

like image 78
Isabella Chen Avatar answered Sep 04 '25 21:09

Isabella Chen