Mobile Development 22 min read

Comprehensive Strategies for Reducing iOS App Package Size in a Large‑Scale E‑commerce Application

This article details a two‑phase, data‑driven approach to shrinking a rapidly growing iOS shopping app from over 300 MB to around 214 MB by focusing on install‑size metrics, resource‑file analysis, unused‑image removal, icon‑font adoption, dynamic‑library stripping, LTO, PNG handling, and automated monitoring.

JD Retail Technology
JD Retail Technology
JD Retail Technology
Comprehensive Strategies for Reducing iOS App Package Size in a Large‑Scale E‑commerce Application

As the business grew, the shopping app’s IPA size exceeded 300 MB, hurting download cost and promotion efficiency. Starting in September 2018, a two‑phase slimming project was launched: Phase 1 (V7.2.0‑V7.5.2) reduced the package by 46 MB on an iPhone X (iOS 12); Phase 2 (V8.1.0‑V8.4.0) further cut 57.6 MB, bringing the size down to 214.4 MB, with ongoing work.

The primary optimization metric chosen was the “Install Size” shown on iTunes Connect, because reducing this value automatically reduces the “Download Size”. The IPA consists of Frameworks, PlugIns, Mach‑O executables, Assets.car, react.bundle, generic bundles, and other files – all of which influence the final size.

Resource‑file optimization focused on three areas:

Large resources: over‑50 KB images in Assets.car, bundle images, videos, and 3D models were either removed, replaced with network‑downloaded placeholders, or compressed to JPEG/WebP.

Unused images: Since source code is unavailable, a package‑level scan was performed. Executables were examined with otool -v -s __TEXT __cstring , readable files (.plist, .js, .html) with regex, and binary nib/storyboard files with ibtool . Images not referenced were listed, reviewed, and 196 unused images (≈1.5 MB) were deleted.

Download‑conversion: A JSON mapping (example below) was introduced to replace heavy local images with CDN URLs, supporting 2× and 3× assets, online updates, and WebP compression.

{
    "imageId1": {"3x": "url1", "2x": "url2"},
    "imageId2": {"3x": "url3", "2x": "url4"}
    ...
}

To further shrink the bundle, an iconfont strategy replaced dozens of raster icons with scalable vector fonts, reducing both file count and size.

Dynamic‑library slimming used strip -x in a Release‑only script (shown below) to remove unnecessary symbols, saving ~28 MB across arm64 and armv7 binaries.

if [ $CONFIGURATION == Release ]; then 
    strip -x path/to/dylib 
fi

Additional build‑time optimizations included enabling Link‑Time Optimization (LTO) which saved ~4 MB, and adjusting Compress PNG Files and Remove Text Metadata From PNG Files settings. The related Perl script copypng was examined to understand why disabling compression alone did not cancel Apple’s negative PNG optimization.

#!/usr/bin/perl
my $PNGCRUSH = `xcrun -f pngcrush`;
chomp $PNGCRUSH;
my $compress = 0;
my $stripPNGText = 0;
# ... option parsing ...
if ($compress) {
    @args = ($PNGCRUSH, "-q", "-iphone", "-f", "0");
    push @args, "-rem", "text" if $stripPNGText;
    push @args, $SRCFILE, $DSTFILE;
} else {
    @args = ("cp", $SRCFILE, $DSTFILE);
}

Asset Catalog analysis relied on assetutil --info to extract the SizeOnDisk field for each image, providing accurate size aggregation (error < 1 MB). When Apple introduced automatic sprite‑sheet generation for iOS 9+, the team reverted to iOS 8‑compatible builds to keep size measurements reliable.

Finally, a monitoring system was built to track package composition, module‑wise resource usage, and violations of the new resource‑usage guidelines, sending email alerts and future optimization suggestions.

The combined effort demonstrates a systematic, repeatable process for controlling iOS app bundle size in large, modular projects.

mobile developmentiOSresource managementAsset CatalogApp Size Optimizationdynamic libraries
JD Retail Technology
Written by

JD Retail Technology

Official platform of JD Retail Technology, delivering insightful R&D news and a deep look into the lives and work of technologists.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.