How to refresh APNS certificates

Scott
5 min readMar 20, 2019

Premise

So these are the steps when you have already set up your push notifications and successfully tested them before, but your certificates have expired or have somehow been invalidated.

Maybe you see something like this when you try to test with Pusher.

I feel your pain.

How To

Now go to Apple’s developer program. We will upload the request for a certificate in order to get another one. Sign into your developer account.

After signing in, click on Certificates, Identifiers, and Profiles.

First click on “Profiles.”

Click on Profiles
Click download
Double click on the mobileprovision to apply it.

Try sending the push again.

Second if that didn’t work.

Toggle this
  • Make sure you are using the certificate that would match the provisioning profile that is active.
  • Grab a fresh device token and paste it in.

Third, if that didn’t work.

  • Lets get a new certificate:

Instead of going to the certificates section directly, we must first click the app ids.

Find your app’s id and check that the bundle id matches from your project.

Click the edit button.

Click on “Identifiers”
Find your app’s bundle id and then click on its row.
Scroll down to push notifications, click “Edit”
Click on Production SSL Certificate, you can use it for production and development.
Lets request a certificate to upload.
open up keychain access
Click Request a certificate
provide your email, click “saved to disk”, then continue
Rename it to match your project.
upload the signing request and then click “continue”
Click Download

Then double click on the downloaded file.

It should show up in your keychain access. Most of the certificates will be hard to differentiate, you can find your certificate because the end of the Name of the certificate will be your project’s bundle id.

Click Add
Picture from https://www.appcoda.com/push-notification-ios/

Then click Certificates, Login, then right click your certificate aka the cert that has a expiration date a year and a month from now.

Click Export "Apple push services: cor..."
You can rename it to something more relevant. Click Save.

Click OK.

Put in your computer’s password here.

You should now see your glowing p12 certificate.

Now go back to the Apple Developer website again.

Click Profiles
Click +
Tick App Store
Click Continue
Find the option that contains your bundle id.
Click Continue
tick the circle
Click Continue
Give it a name and then click Generate
Click Download

Choose the one with a date that is farthest in the future.

Now give it a name.

Then, continue

Then click download.

Click on Downloads to access it, drag it out to your desktop, then double click it. It copied your projects bundle id that you gave on the Apple Developer Website, so it finds your app and installs itself when you double click it. Smart.

--

--