How We Reduced Pinterest’s iOS App Size by 30+% / 50MB
Article Summary
Pinterest slashed their iOS app size by 30% (50MB) and immediately saw install rates climb. The culprit? A sneaky localization bug multiplying files across app extensions.
Pinterest's iOS team discovered their Bazel build system was duplicating localization files into every app extension, bloating the bundle unnecessarily. Engineer Liang Ma shares how they diagnosed and fixed this architectural issue.
Key Takeaways
- Localization strings were copied into each extension instead of shared
- Fixed by redirecting NSBundle calls to main app bundle path
- Download size dropped 30% with increased install conversions
- Each extension had duplicated every Localizable.strings file
- Future plan: self contained bundles for better modularity
A single architectural fix eliminating duplicate localization files reduced Pinterest's iOS app by 50MB and boosted installs.
About This Article
Pinterest's CI job used Bazel query to scan source code and send strings to Mojito for translation. When app extensions were added, each extension's BUILD file copied the entire Localizable.strings file into its own bundle. This created duplicate copies across multiple extension modules.
Liang Ma's team fixed the extension BUILD files to stop copying localized strings from the main app bundle. They also updated NSLocalizedStringWithDefaultValue calls to explicitly reference the main app bundle path instead of relying on +[NSBundle mainBundle], which was returning the extension's subfolder path.
The fix reduced app size by approximately 50MB, which was 30% of the total app size. This came from removing duplicate Localizable.strings files across all extensions. After rolling out the change in Pinterest iOS v9.1, the team saw measurably more app installs on new versions.