Mobile Development 7 min read

How Baidu Maps iPhone Team Optimized App Size with Bitcode and App Thinning

This article explains how Baidu Maps' iPhone client enabled Bitcode and leveraged Apple's App Thinning to reduce binary size, detailing the 64‑bit transition, the bitcode enable process, analysis with otool, a custom Python check script, and post‑thinning validation steps.

Baidu Maps Tech Team
Baidu Maps Tech Team
Baidu Maps Tech Team
How Baidu Maps iPhone Team Optimized App Size with Bitcode and App Thinning

Binary Thinning

Since 2015 Apple has required 64‑bit builds, which doubled binary sizes and pushed many apps toward the 100 MB limit that cannot be downloaded over cellular networks. To mitigate this, Apple introduced App Thinning, allowing the App Store to deliver device‑specific slices of an app.

Why Apple Enforced 64‑bit and Thinning

Multi‑architecture iOS system packages can reach several gigabytes, consuming valuable device storage.

Uniform 64‑bit binaries would increase overall app size, reducing the number of apps a user can install.

Apple can perform the slicing on its platform if apps provide both 32‑bit and 64‑bit slices, effectively halving the binary portion delivered to each device.

App Store Packaging Process

The traditional upload flow sends a single IPA to Apple, which cannot separate architectures or generate dSYM files. Apple therefore adopts a two‑step approach: developers submit an intermediate product, Apple slices it per device, and then returns the appropriate dSYM to the developer.

Enabling Bitcode

All intermediate products must have Bitcode enabled. In Xcode 7 the main project option exists, but every dependent library also needs Bitcode. Baidu Maps, with many third‑party components, required extensive coordination to turn Bitcode on for all sub‑projects.

Archive succeeded, but the “Include Bitcode” option was missing due to an Xcode 7.0 bug. The bug was fixed in later Xcode versions; with Xcode 7.2 the archive contains a .a file that still includes an object file lacking Bitcode support.

Analyzing .a Files with otool

When Bitcode is truly enabled, each .o in the .a archive contains a __bitcode segment. Using

otool -l

reveals this segment. Objects that lack Bitcode either have a __bitcode size of 0x1 (empty) or the segment is absent.

Automated Bitcode Check Tool

Because Baidu Maps integrates dozens of internal and external components, manually verifying Bitcode for each library is impractical. The team built a Python script that scans .a files for the presence of a non‑empty __bitcode segment.

The script can be run before each component’s release to ensure Bitcode is enabled. However, during linking some objects may be omitted from the final binary, so the archive can still succeed even if a .o lacks Bitcode.

Post‑Bitcode TODO

After enabling Bitcode, the next step is to compare the size of the original IPA with the App Thinning result provided by Apple. This helps quantify the size reduction and assess the impact on end‑user experience. TestFlight can be used to validate the real‑world performance of Bitcode‑enabled builds.

The team encourages developers to monitor the App Thinning report and iterate on their packaging strategy.

Mobile DevelopmentiOSBaidu MapsApp ThinningBitcode
Baidu Maps Tech Team
Written by

Baidu Maps Tech Team

Want to see the Baidu Maps team's technical insights, learn how top engineers tackle tough problems, or join the team? Follow the Baidu Maps Tech Team to get the answers you need.

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.