How to reduce the package size of ML Kit iOS? - 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.

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

Related

Is it possible anyhow to load resources to an iOS app after it is installed on device?

I want to reduce the size of the app to its minimum level. So what all resources i can load from remote after installation? I know I can download images from remote. But can I download libraries or pods from remote after installation? I know we need those files to generate ipa files. Is there any way to setup app with minimum required code, and "load" rest of the code from remote, and is it even possible?
On a different note, I think there should be a framework which checks for existing libraries (like AF Networking) on device, and if it is not there, then downloads it, and all the apps which need it use it. This will help reduce the size of apps considerably.
For assets (images, movies, sounds, etc...) absolutely.
For executable code (libraries, frameworks and pods) absolutely not.
That would directly contradict one of the rules that Apple has in place on apps on the App Store.
Any executable code has to be bundled and submitted to the App Store for approval.
Apple's iOS developer guidelines state:
3.3.2 — An Application may not itself install or launch other executable code by any means, including without limitation through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise. No interpreted code may be downloaded or used in an Application except for code that is interpreted and run by Apple’s Documented APIs and built-in interpreter(s).

Trimming down skobbler map size & offering download alternatives

We're making offline road-trip planner.
We want to use skobbler maps but the main issue is that the framework is way too big.
Even with some trimming down options, it's still over 110Mb (only with skobbler framework).
Inside SKMaps.framework there is a document SKMaps with 95Mb is size.
No program can open this document (at least no program i have on my mac atm).
I was wondering what might be in this document and is it possible to 'open' it and remove unnecessary files from it.
I am asking this because when I launch my app with skobbler in it, there is a map of entire world available to explore.
I don't need that. I only need several states in the US and that's it. One state is roughly 30Mb in size, which is acceptable and download option for each state can be an asset, so a user downloads only what he needs.
IF there is no way of deleting entire world map from framework, what are my other options?
Can this file SKMaps, with 96Mb in size be downloaded after a user launches an app, so I don't have a huge app on the app store?
Can i write and launch my app without SKMaps in the app bundle from the start, and I make the user download it once he starts an app for the first time?
Edit the SkMaps.bundle and this will impact the .framework object.
Indeed, the unpacked size will be > 100 MB but when packing it (generating the .ipa file) it will only add ~20MB to the final app file (i.e. compiling the demo project without audio advices and only 1 style, targeting both armv7 and arm64 will generate a .ipa file of ~ 19.4)
By default the demo app does not "contain" any maps - it connects to the servers and downloads the map from there.
If you'd like to download "offline maps" - see the "Maps.json and downloads" example in the demo app.
If you're intent is to "prebundle" an offline map within your app see: http://sdkblog.skobbler.com/creating-an-app-with-a-pre-bundled-map/

How to reduce size of an iOS app built with kivy-ios?

We're building an iOS app using Kivy-iOS.
Our current app size is 397MB (as compared to 40MB for the same app deployed on Android using Buildozer).
We need to drastically reduce the size of this app but can't figure out how to do it.
Are there parts of the kivy-ios library that we could exclude to reduce the app size?
If so, how would we do it?
So far, we've gone one-by-one both within the tools folder of kivy-ios and within xCodes 'linked frameworks and libraries' but haven't been able to eliminate anything of substantial size while also successfully deploying the app.

IPA file size Flash Builder export

i'm going to build an IOS app for the IPad, and i made a quick test.api. My issue is that the size of the file is already 13 MB big. i added a video and a sound for testing (together like 9 MB) so i was wondering is there a minimum file size when making a ipa in Flash Builder?
Maybe around 4 MB?
13MB - 9MB = 4 MB?
and then 4MB is the standard ipa size.
Flex/AS3 mobile apps must include the SDK in the output in order to run. It is referred to as "Captive Runtime" and is an option on Android, but mandatory on iOS. Essentially, they are native apps that run as virtual machines that allow you to display your AS3/Flex apps on the device without a hint of Objective-C or Java. Those SDKs are far from small. If you look in %FlashBuilder Install Directory%/sdks/, you'll see that those SDKs can be close to 1GB in size. Obviously, that doesn't all get included, but from my experience, the smallest IPA I have ever created was around 8MB.
I don't have a solid answer for what the absolute minimum size of those SDKs are, and Google turned up nothing, but my guess would be somewhere between 4-8MB, depending on if you used Flex or not.

Why is my app 25% larger on the App Store?

The zip file I uploaded is 19.5MB, but on the App Store, Apple reports it as 24.5MB -- too large for over-the-air downloading. Is Apple adding a 5MB wrapper? Decompressing and recompressing less efficiently? Using 815K "megabytes"?
From Apple:
When your application is approved by
Apple to sell on the App Store, it is
encrypted for DRM purposes and
re-compressed. When the encryption is
added, the size of the compressed file
will increase. The exact size of the
increase will vary from app to app,
however, the size increase can be
large when the binary contains a lot
of contiguous zeros. We are unable to
guarantee the size of your file after
the encryption has been added.
Source (Expand section View the file sizes of a build (iOS, tvOS))
Download the app from the App Store with iTunes. You should end up with a .ipa in ~/Music/iTunes/Mobile Applications which is (hopefully) approximately what you get from the App Store. Check its size. You can additionally use something like unzip -Z myapp.zip to check the compressed size of individual files (an .ipa is just a .zip).
If, as in FreeAsInBeer's answer, your executable's compressed size is increasing loads, then it might be worthwhile trying to fix this (5 MB is a lot of code). Compiling with -Os might be helpful.
Also note that the .ipa will have some additional info, namely iTunesArtwork (from the up-to-512x512 App Store app icon) and iTunesMetadata.plist (which has stuff like the App Store category) and some FairPlay information. I'm not sure which of these are sent to the device.
And finally, Apple might be using M = 106 instead of 220 — 19.5×220 ≈ 20.4×106 . IIRC this was one of the changes in Snow Leopard.

Resources