I have been developing applications for iPhone ever since Apple released its first iPhone back in mid 2007, initially for browsers and later on with Apple iPhone SDK as soon as its first Beta was released. It's after making my first distribution build of the application that I realized the fact that there is no way to test the distribution build at all. That kept me worrying until the app made it through Apple's review process.
So many questions that kept me waking up from sleep:
Was the build compiled properly ?
Is the provisioning profile alright ?
Will the app show up the "A signed resource has been added, modified, or deleted." error ?
Are all the resources that I added and replaced just before the final version, updated properly ?
Was any of the APIs I used from the sample code I grabbed from Internet , "Private" ?
The fear that something may go wrong is so intense when apple takes almost ten days to get the app reviewed and get back to us with a mail that says, thanks but no thanks, we are afraid that we cant let it through this time because...............
(Every time I read these first two lines, I go blind and deaf for a few minutes and was never able to figure out what exactly was the reason for rejection for the first few minutes. After the initial panics and moaning, I will figure out the error to be something like a school boy being asked to return home and come back after a complete redressing session because one of his shirt button is open.)
And that means another 10 minutes of fixing and 10 days of waiting.
It may get so worse that a 'predict the FIFA 2010 winners' app may actually make it to the itunes only while Shakira and South Africa’s Band Freshlyground are leaving home after their live performance at the finals.
When apple introduced In App Purchase and Push Notifications, the things got even worse.
The way the debug build and the distribution build work with In app purchase and apple push notifications are very different that there is a lot of scope for a distribution build of an app to go wrong even if the debug or adhoc builds worked just perfect.
So how to test a distribution build ?
I tried several ways to install a distribution build on to a device, but XCode or iTunes will complaint about the application being signed with invalid entitlements.
But yesterday when my last submission was rejected by apple due to the push notifications not working as expected, I was really challenged. The app was a kind of reminder and push was the main functionality. We tested the push without even a single miss for around 15 days before submission to itunes connect. From the details and screenshots, it was evident that didfailtoregisterforremotenotificationswitherror was getting called whenever app tries to register the push using
[[UIApplication sharedApplication] registerForRemoteNotificationTypes
This happens usually on the simulator alone. I have all versions of iPhone devices for testing and not one of them , not even the iPhone 1.0 returned this error.
So I had to conclude that something went wrong with the distribution build.
Though I had tried several times before, this time I went ahead and tried it with an iPhone 4.1 device. As expected, it failed with "invalid entitlements" reason. But I was not ready to give up and jailbroke the device. Now the apples restrictions all went away and the .app file was successfully installed through the XCode Organizer.
I found my push issue was because I have signed the distribution build with an app store distribution provisioning profile that was created before enabling the production push for the appID.
So lesson learned : make a new distribution provisioning profile every time you change something about the app in the portal.
I created a new provisioning profile , and the error was cleared.
Thanks to jailbroken iphones that allows to install Distribution build before apple submission. Without those, I would have kept guessing for days !