There are a lot of good articles written about this topic. However, in their own process, even if others have written well, still will encounter such a problem. Let's write it again.
This document records the application of a certificate from scratch, to be notified at the end. Of course, the premise is that we have a suitable developer account.
preparatory work
1. Login to the developer account, if the account permissions are appropriate. We will see such as:
Or the latest interface should be the following (just found page updated):
2. Click on the menu in the red box and it will come to the following screen:
Create App ID
The app ID you want to create here is the bundle ID of our app.
3. Click "App IDs" on the left to see all the app IDs under the current account.
4. Click in the top right corner.
Add the description of this app ID under app ID description, such as "My Test app".
App ID prefix fill in the bundle ID of the app. Don't take the * number.
Under APP services, tick push notifications.
5. Click Continue to see the information for the app ID you just created. Such as:
6. Click on the "App IDs" on the left, and you'll see one more of the list on the right.
Request a Certificate
Push certificates are divided into development certificates and production certificates. We take the production certificate as an example.
7. Click "Production" under "Certificates" on the left to see all the production certificates under the current account
8. Click in the top right corner.
9. Select Apple Push Notification service SSL under Production, and click Continue
10. Under App ID, select our new app ID. Click Continue
11. Click Continue, to the following interface, we need to upload the CSR file
Next, we will first generate the CSR file locally.
12. Open the Keychain (Keychain Access) program and click on the Keychain access in the upper left corner to make the choice
12. You will then see the following tips
13. Fill in the information such as the mailbox, select "Save to Disk". When you click Continue, you will be prompted to save the selected save location. Select the appropriate save location to save.
14. Next step #11, we will upload the CSR file we just generated. Click "Choose file", select the files we just generated, and then click Continue. You will then come to the following interface:
At this point, our certificate has been created. Click Download to download the certificate locally. I create a folder on my desktop named cert and place the certificate under that folder. It will be used for a while.
Create provisioning Profile15. Click Distribution under Provisioning profiles on the left
16. Click in the top right corner.
17. Click on House under Distribution, click Continue
18. Under App ID, select our new app ID. Click Continue
19. Select the account that the certificate we just created belongs to. Click Continue
19. In Profile name, enter the name of the profile. Click Continue
At this point, our profile has been created. Click Download, download to local. I put the downloaded profile under the new Cert file in #14 step.
Generate a certificate for use by the server this step is to run the SSL command on the basis of the certificate that we have already applied for. Generate a certificate for use by our server (that is, our server will load the appropriate certificate when sending a notification). 20. Open the Cert folder on the desktop, double-click on our new request certificate, and the certificate will be poured into the keychain (Keychain Access). Open the Keychain program, click Certificate, find our new certificate, right-click Export. Such as:
21. Enter a file name and select the location you want to save (I put it on the desktop). Click Save
22. When exporting, you will be asked to enter a password, such as:
23. Enter the password. Click OK. The certificate is saved on the desktop
24. OK, the location you just saved is not good. Drag the certificate you just exported to the Cert folder.
25. Under Cert, create a Gen folder to copy the downloaded certificate and the exported certificate to Gen. And under Gen file, do the following renaming:
Download the certificate->developer_identity.cer
The exported certificate->MYKEY.P12
Note: This step is not required and can be omitted entirely. I just want to make it easy to use the next command (refer to from here).
25. Open Terminal (Terminal) program, CD to desktop under Gen folder. Enter the following command in turn:
OpenSSL x509-in developer_identity.cer-inform der-out developer_identity.pem-outform Pemopenssl pkcs12-nocerts-in my Key.p12-out mykey.pemopenssl pkcs12-export-inkey mykey.pem-in developer_identity.pem-out iphone_dev.p12
You will be asked to enter the password (the password for the exported certificate and the password for the newly generated certificate), as required. Such as:
After running, several files are generated under Gen, where Iphone_dev.p12 is the certificate for use by the server.
Signing a program with a new certificate of course, we need to use a new certificate and profile when we pack. For example: Under Project,
Under Target,
Next, it's packed. Of course, you also need to implement notification push on the server side.
Reference:
http://blog.csdn.net/kepoon/article/details/22672133
Http://stackoverflow.com/questions/7213074/notnoop-java-apns-push
iOS push certificate from request to use