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
- Apple developer, Identifiers, select the App you want to generate:

Click Edit:

-
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.
-
In next page, press continue, click choose File

-
Download the certificate and click Done

Generate p12 file:
- 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

- Done
Congratulations, now you have both cer and p12 file

Nice tutorial
LikeLike