My push notifications don’t work in production

This isn’t so much a post as a I-wish-I’d-read-this-somewhere.

When you distribute an iOS app, you do so via a provisioning profile. Distribute in this case means anything from putting it on your own iOS device connected to your Mac to debug to submitting it to Apple for the app store.

You have to create these things in a web based interface and then install them into Xcode and use them during the compilation of your app.

Earlier versions of Xcode had enormous problems with these that could have you uninstalling and reinstalling profiles, certificates and keys until you were ready to go back to writing shell scripts for a living.

Now it’s much better.

However you still have to update your provisioning profile every time you want to add a new device (when it’s not going to Apple) or, as I was reminded today, when you add a push notification certificate.

After submitting an app to Apple, I added push notification support and submitted the update. A bit later I realise that the apps weren’t registering with my sever, in fact they didn’t even appear to be asking the user  if they wanted to receive said notifications (and this happens before anything).

Yet it worked fine for the test apps.

After a fair bit of fiddling and reading old instructions it dawned on me that the provisioning profile I used to send to Apple was the same one I made for the first submission, before I set up push notifications.

I had updated the ad hoc and development profiles when I added new devices to test on, but not the app store one.

Now, this is all in the documentation I’m sure (although I’ve yet to look), and I should have read it. But I have already read that documentation for another app and so I wasn’t going to trawl through it looking for that one thing I’d missed.

What I really needed was for the developer portal  to warn me that my new push certificates would not work until I updated my provisioning profile.

That would have been good interface design.

This entry was posted in iOS Development and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.