Keith
Keith

Reputation: 1133

iOS app binary doubled in size in Xcode 5

My iOS app needs to be very small in order to be downloaded at events with low cell reception and no wi-fi. My app used to be 1.8 MB on the App Store, and it took me a long time to get it that small. The binary itself (inside the .ipa file) was 1.6 MB uncompressed.

I built the latest version of my app in Xcode 5, and all of a sudden the binary itself is much bigger. The app is 3.9 MB on the App Store. The binary itself is 3.4 MB uncompressed.

I haven't changed my build settings, nor my targets (armv7 and armv7s only). The code is mainly C++ but also Obj-C.

Why would this happen?

Upvotes: 2

Views: 2680

Answers (4)

Daniel
Daniel

Reputation: 66

I had the same problem with our game after upgrading to Xcode 5. Using file and otool I get the following results:

Xcode 4 build

> file Game.app/Game
Game.app/Game: Mach-O executable arm
> otool -h Game.app/Game
Game.app/Game:
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
 0xfeedface      12          9  0x00           2    29       3332 0x00218085

Xcode 5 build

> file Game.app/Game
Game.app/Game: Mach-O universal binary with 2 architectures
Game.app/Game (for architecture armv7): Mach-O executable arm
Game.app/Game (for architecture cputype (12) cpusubtype (11)):  Mach-O executable arm
> otool -h Game.app/Game
Game.app/Game (architecture armv7):
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
 0xfeedface      12          9  0x00           2    32       3588 0x00218085
Game.app/Game (architecture armv7s):
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
 0xfeedface      12         11  0x00           2    32       3588 0x00218085

To prevent Xcode 5 from building a fat (both armv7 and armv7s) binary, go to Build Settings for the target and set the Architectures entry explicitly to only armv7 (the default is $(ARCHS_STANDARD)).

Upvotes: 2

hotpaw2
hotpaw2

Reputation: 70673

Too see exactly what's inside and compare the 2 ipa files (old vs. new), just change the suffix to .zip, unzip them to list the contents, and perhaps run the lipo command on the executable binary to see how many architectures were included.

Upvotes: 0

rastersize
rastersize

Reputation: 487

I’d guess that the app has now been built for both 32- and 64-bit (arm64). You can verify this by running file /path/to/TheApp.app/TheApp. Also see Apple’s “64-Bit Transition Guide for Cocoa Touch” for more information on the new architecture.

Upvotes: 2

Steve
Steve

Reputation: 1840

Try building it for armv7 architecture only. I worked on a project where app size was a priority, and the only way for us to get the app down below the 50 MB cutoff was to remove armv7s.

Upvotes: 2

Related Questions