The push in app is becoming more and more popular, but configuring certificates for people who don't do a lot of push is really painful. This article will take an integrated push as an example to explain the process of configuring the APNs certificate in detail.
Integrated push overall is divided into the following steps (this article only 1, 22 steps)
- Create app application and configure APNs certificate
- Create an application on a push platform
- Integrating a push SDK in a project
- debugging, Implementing push
1. Create app application and configure APNs certificate
Login to Apple Developer account Ps://developer.apple.com/account/overview.action ">https://developer.apple.com/account/overview.action
Click Identifiers, create AppID, and if there are AppID, skip this step
Attention!!! If you have AppID, be sure to select a consistent ID to configure the certificate and each certificate can only correspond to bundleid the same project
At first, push notifications was disabled.
Click Edit, tick the push notifications, according to the corresponding environment to choose a different button to upload certificate.
A friendly hint, if your project is the first integrated push, even if your previous version of the online, but the online version does not integrate push, click the development of the Environment button, do not covet click the production environment of the button.
Then there's this interface, direct continue
Then you're ready to submit your local CSR certificate.
1.1 How to generate a local CSR certificate
Here's how to generate a local CSR certificate, and it's really a long time since we started.
First Open Launchpad
Click the "Keychain Access"-> "certificate Assistant"-> "request a certificate from a certification authority" in the upper-left corner of the screen
Fill in the address of the e-mail and select the "Save to disk" option
Save to the desired location
Here, our CSR has been built successfully! Go back to the steps we just made and upload the CSR to the developer account
Click on download to find the. cer file we just downloaded, double-click directly
Enter your password, which is your own computer's password.
Then we can see the certificate and the private key that we just double-clicked in "Keychain Access"-> "My Certificate" (if the certificate is too much, the search for the keyword in the upper right corner can quickly find the required certificate, if the name is not clear, Directly based on the expiration of the following time can be roughly determined which certificate was just installed
Right-click our certificate, select "Export"
Select the place we need to save, and note that the following file format is selected in the ". P12" format.
Also enter the computer password
Now we have to set the password for our. P12 certificate, we must remember the password we set, and the push platform behind will need the password we set.
So our P12 certificate will be generated successfully! The first step is done! The P12 certificate should remember where it was placed, and it will be used later.
2. Create an application on a push platform
First we register an account on a push table, then log in, and choose to register the application
All asterisks on this page are required, according to the following picture text prompts, fill out the information, password, and upload what we just generated. P12 Certificate
Select "Create Push" after registering
Click on the application configuration, you can see the parameters required in the project, after the integration of the project to use
One last hint of friendship, after the project is on line, follow the method of this article to generate a "production certificate", directly in the following figure to replace the production certificate, and then the following "development environment" will be automatically changed to "production environment", then all downloaded from the App Store installed app can be notified. The advantage of doing this is that you don't need to create a new application without modifying the code parameters.
This article first said so much, in summary in the process of doing push the biggest problem is to configure the certificate, and then there is a common problem is that the project can not register to get Devicetoken, which is generally still related to the configuration certificate. Either the Bundleid of the project and the ID of the build certificate are not consistent. In the push of the question can be in the following message to me, there is time for a certain return