Swift Tricks

My own, mostly internal blog of Swift tips and tricks

Generating push notification certificates

Production vs development certificates

First things first, you have to decide whether you are creating a production or development certificate:

  • Production certificates will deliver push notifications to devices installed via TestFlight or App Store
  • Development certificates will deliver push notifications to devices that have an Xcode-built version

Be aware that on certain providers (like Azure) you can only upload one kind of certificate per environment.

Generate a request

With keychain access:

  1. Click Keychain Access / Certificate Assistant / Request a Certificate from Certificate Authority...
  2. Fill out your email and a name. Leave CA name empty.
  3. Save the file to disk

Create the certificate

  1. Go to Apple Developer / Certificates, Identifiers, Profiles / App IDs (found here)
  2. Select the appropriate App ID and click Edit at the bottom. If the Edit button is disabled the you might not have the proper permissions set up.
  3. Follow the directions to upload your certificate request
  4. Generate and download the certificate

Create a p12 file

You will need to upload a p12 file to whatever push notification provider you are using. To generate this:

  1. Double click the *.cer file you have just generated; this will add it to your Keychain (via Keychain Access)
  2. Open Keychain Access and find the *.cer file. Right click and select Export...
  3. Choose p12 as the file format and select a location
  4. If your provider allows (or requires) a password, fill out a unique, preferably generated password here
  5. Save and upload the file to your provider