After several days of trying to get an iOS application loaded in our Apple Store account, we finally figure out the problem. While we’ve had success with other application uploads in the past, this application build with Rhomobile was particularly problematic. Turns out the issues was with Xcode corrupting the PNG files when compressing them for the archive.
Invalid Binary? Tell Me More…
However the Application Loader, the recommended application for getting your apps into the iTunes connect store, was not very helpful. We would upload, no errors, no email and then see “invalid binary” moments later when checking our iTunes connect listing. The first trick to resolving the issue was getting a proper message back from Apple as to what was wrong.
Build & Archive
A lesser-known method for deploying to the app store is to use the Xcode archival tool. First build your app with Xcode using the product/build menu. Then use Product/Archive to create the archive for distribution. Normally this will open the Xcode Organizer window and select the archive tab for you. If not, you can get to the Xcode Organizer via the main Xcode menu.
From here you can validate and distribute your application in separate steps. In our case validation and distribution both went without issue. However the BIG difference was in how Apple handled our upload after the process was complete. For some reason this distribution method triggered something over on the Apple servers that got them to send us an email. “Invalid PNG format for icon144.png”. Great, now we’re getting somewhere.
Corrupt PNG, Really?
Our PNG file opened without any issues in a number of editors as well as the Preview application that came with OS/X. It renders in a browser. The original PNG was just fine. What was going on here?
After some digging around on Google we found some deep down posts about “invalid PNG” files and how Xcode is corrupting some, but not all, PNG files. Turns out the default build settings has compress PNG turned on. Turning this off seems to help. In XCode select your target project, go to build settings and expand the package section. Compress PNG is one of the first settings and is often set to yes. Toggle this to no and rebuild.
Sure enough, in our case, the PNG was not longer flagged as corrupt.
There are a myriad of other things that can cause your app to generate the Invalid Binary message, but this is one more possible fix that may get you to the next step.
Good luck battling the Apple Store with your app efforts!