iOS App Store Submission Problems

My new years resolution was to, as an iOS Developer, share any useful ‘tidbits’ I come across in my daily role, in order to help save others from also wasting hours finding solutions to the same problems.

Today I spent a number of hours racking my brain over an iTunes Connect error when uploading an .ipa file to the App Store. We build our .ipa file using a combination of Jenkins and a custom build script. The build script runs the usual xcodebuild archive and export commands. This setup has served us well for a number of releases to the App Store with very few issues. Recently we added features to our apps that required additional entitlements (these can include things such as app groups and push notifications). When uploading our .ipa file to iTune Connect it was failing with ‘ITMS-9035 A sealed resource is missing or invalid’.

It turns out this error code can mean one of any number of things and is a bit of a catch all. It’s probably worth going though the steps outlined in this stackoverflow post first, however if none of that works, read on.

On closer inspection we found that processing an archive though the Xcode Product > Archive menu actually does something slightly differently from using via the xcodebuild command line tools. It includes an ‘archived-expanded-entitlements.xcent’ file in the final .ipa package, which is not included when created via the command line. This file is important when it comes to submitting to the app store.

To verify, you can renamed the .ipa file extension to .zip, then unzip the folder, open the Payload folder and then right click > show package contents on the .app file within. Here you should see the above file.

If the file is not there, this is likely the cause of your issue, you can also verify this by examining the console output in the Terminal/Jenkins, there should be a couple of lines to say the .xcent file could not be found.

In order to force the command line tools to match what the Xcode archive and export process does, you must specify the -exportOptionsPlist flag in the export command.

The plist file needs to include at a minimum…

By specifying this plist option, it has the side effect of correctly including the required .xcent file within the final .ipa. You should now be able to successfully submit to iTunes.

It would be great if Apple documented this in the future as it has us stumped for a while this one :0)