Well, it was a year ago that I updated my app Grabble Words to use Parse Server (for storing data in the cloud) via herokuapp (for running applications in the cloud) and mongodb (database hosting service). Here‘s where I delved into some difficulties with push notifications at the time.
I’ve just received a notification from Apple reminding me that their production push services certificates only last for a year, meaning that there’s a little annual maintenance to do to keep notifications popping up on people’s devices. Otherwise how are people going to know that the other player has had their move!?
Making this update isn’t that big a job, but it can be hard to get your head back into these sorts of things. This could be a good time to record the process here…before i forget!
Basically two things need to be done:
- Create a new push services certificate in Apple’s member center (aka Certificates Identifiers and Profiles). What we need out of this step is a p12 file.
- Replace your app’s push services certificate in heroku with your new p12 file.
Fleshing these steps out a little:
Creating a new push services certificate
- Open Certificates, Identifiers and Profiles.
- Find your app in the App IDs section and select Edit.
- Find your app’s push services certificate that is expiring. Below it select Create Certificate.
- You will find instructions appear for requesting the certificate in your keychain. Follow these instructions!
- Once you have the request, you can upload this back in the Certificates Identifiers and Profiles page.
- You should now have a certificate. Download this certificate, which should be a cer file.
- Double click on the cer file which will install the key into your keychain.
- Finally, from the Certificates section of your keychain, export this cer file, and you should have a p12 file. Hooray!
Replacing your app’s push certificate file in heroku
- Find the local folder for your app’s heroku file system heroku.
If you haven’t cloned this, or perhaps you’re on a different computer from when you cloned it originally, you’ll need to find the folder that you cloned locally when you first generated a heroku app. (If you don’t have one, check here how to do this.
- From the heroku folder for your app in Terminal, log into heroku. (hopefully you still have your password!)
- Find your production push services certificate locally and replace it just in Finder with the p12 file you downloaded earlier.
- Back in Terminal, upload the updated p12 file using git. Uploading in git is called ‘pushing’, so I guess we’re pushing the push certificate…
git add . git commit -am "replaced push services certificate" git push heroku master
That’s it! Grabble Words should now have its push services certificate safely updated in the cloud, and we have another year of game notifications, hooray!
Leave a Reply