Using ditto to strip Mac app bundles

1st May 2011

The last update of Smart Shooter was unexpectedly rejected during the submission process, immediately after upload to the app store. This was a bit puzzling at first, as the previous update submission has been accepted with no problems, and this update was a fairly minor code change – there was no major changes in either functionality or architecture, it simply added support for a couple of new Canon cameras.

Apple’s reason for rejection was ‘Invalid Binary’, with a statement saying:

Unsupported Architecture – Application executables may support either or both of the Intel architectures:
i386 (32-bit) x86_64 (64-bit)
Other architectures may not be included in submitted binaries. Confirm that your Xcode project’s build settings include those architectures and no others.

Smart Shooter itself is only compiled to i386, but the app bundle includes frameworks that contain universal binaries, meaning there were PPC binaries present in the app bundle. So Apple must be tightening the automatic screening of apps during the upload process. This makes sense, as PPC binaries are completely redundant here (as Mac app store is only supported on Intel macs), and a smaller bundle sizes means less storage and network traffic for everyone.

I was already aware of this, but the frameworks in question were the Canon and Nikon SDKs, so I had previously chosen to simply include them without modification.

Luckily there is a simple command line called ditto that is able to strip the PPC binaries from all the frameworks, libraries, and executables in a bundle, and its a standard tool in Max OS X.

Heres how to strip all but the i386 binaries from a bundle:

ditto -v --arch i386

For Smart Shooter, I have to use i386 as the Canon and Nikon frameworks do not support x86_64.

blog comments powered by Disqus