If you are a developer with an app in the Mac App Store, then you have probably come across this Apple rule:
Application executables may support either or both of the Intel architectures:
Other architectures may not be included in submitted binaries.
No problem says you. However, until recently, Apple did not check things like dylibs contained within your app bundle. They do now.
This means that you must make sure that any 3rd party components you have imported to your project are stripped of any old PPC remnants or they will fail validation and be rejected within 5 minutes of submission (seems like they have automated these checks).
So how do we do this? Simple enough, but it requires and extra step after building the archive.
- First to be safe, you should check your target build settings to ensure that your target architectures are set to i386 and x86_64. So first click on the Project in XCode, then select the target:
Then, under the ‘Build Settings’ tab look at the ‘Valid Architectures’ and check that it looks like this:
- Then, as normal, build the product for Archive
- The Organser window should open automatically when done. At this point, we’re interested in finding the .app bundle. Where is it? Lets see… Right click on the archive, and select ‘Show In Finder’
- The xcarchive location will be shown. Right click and ‘Show Package Contents’
- Inside here, browse to Products/Users/NAME/Applications/ to see your .app bundleThis is the .app bundle we need to strip non x86 or 64 parts from before signing and submitting to Apple. To do this we can use something like TrimTheFat, by dragging the .app bundle into it’s window and deleting the resulting Jelly SMS Lite-U.app (as it’s not needed any more).Or alternatively, we can run the following command on the .app bundle.
ditto --rsrc --arch i386 --arch x86_64 MyApp.app build/MyApp.app
(from Apple Dev Forums)
If anyone knows of a way this command can be automatically run during the archive or build process (possibly during a build step maybe??), please let us know in the comments below…
[Update] Important: I forgot to mention – you should launch your .app at this stage to test if you’ve actually stripped out something that your app depends on. If so, you will get a crash here. In this case you will need to look at your project more closely and remove the code/parts causing the exceptions.
Now you can simply submit your archive as before and the nasty stuff should all be gone from it and you will once again be in Apple’s good books.