How to generate **.cer** and **.p12** file for iOS push notification

Every time I created a new app with push notifications, iOS, I'm sure I've got everything right and then something refused to work. So this time I'm writing it down so I can't possibly get it wrong again.

Generally, we need 2 files for push notification:
* .cer file
* .p12 file

Generate cer file

  1. Apple developer, Identifiers, select the App you want to generate:

    Click Edit:
  2. Go the detail page of the App, enable Push Notifications, click Create Certificate

    It depends which environment you want to create. For AppStore environment, please click the button of Production SSL Certificate.

  3. In next page, press continue, click choose File

  4. Download the certificate and click Done

Generate p12 file:

  1. Open Keychain Access, drag&drop the cer file you just generated above:

Oooops, there is no triangle icon before the App id. That means there is problem when we generated the cer file. Probably we used the wrong certSigningRequest file.
2. Redo the generating cer file, select the correct certSigningRequest file, now we can see the small lovely triangle icon:

Right click the App ID, select Export "Apple Development iOS Push Service: …."
3. Set File Format to Personal Information Exchange(p12), click save:

Set password and click OK

  1. Done

Congratulations, now you have both cer and p12 file

reference:
https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingProfiles/MaintainingProfiles.html

About Tang

A mobile developer, work in Stockholm, Sweden
This entry was posted in iOS, Mac, Mobile and tagged , , , . Bookmark the permalink.

1 Response to How to generate **.cer** and **.p12** file for iOS push notification

  1. anandkaran says:

    Nice tutorial

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s