如果我正确理解你的问题,答案是否定的,它不应该是同一个文件。我将详细解释整个过程,希望这将澄清情况(以及接下来需要做什么)。
If I understand your question correctly, the answer is no, it should not be the same file. I'll explain the entire process in detail and hopefully that will clarify the situation (and what you need to do next).
当您启用推送通知时,您需要做四件事:
When you enable push notifications, you need to do four things:
- 创建私钥/公钥对。
- 创建证书签名请求(CSR),使用您的私钥签名。
- 将CSR提交给Apple并下载签名证书。
- 创建包含证书的文件和私钥,用于验证每个APN请求。
- Create a private/public key pair.
- Create a certificate signing request (CSR), signed with your private key.
- Submit the CSR to Apple and download a signed certificate.
- Create a file containing your certificate and private key, for validating each APN request.
一些要点:
- I recommend you use different keys for development (sandbox) and production APN. You can re-use the keys if you are sending notifications to different apps, but it is safer if you don't re-use keys between development and production.
- The file you "submit" to the provisioning portal is the certificate request. You will have one CSR file for each certificate. You will create a two CSR for each app (bundleID); one for development, one for production. The CSR created with your development key should be submitted for development and the CSR created with your production key should be submitted for production.
Note: Keep the CSR files. You don't have to have them, but it will save you some time when you need to re-send the certificate requests.
- After submitting your CSRs, you will be able to download the actual certificates. They aren't ready immediately, so give Apple a minute or so and then refresh your browser. The difference between the CSR and a certificate is important: the certificate is signed by Apple; it validates your ability to send push notifications. Download the certificates and load them into your keychain (double clicking is fine).
Note: the certificate is useless without your private key; so you will need to safely export your private key if you switch computers.
- Any computer sending an APN request will need both the private key and the certificate. You can export them as a single .p12 file using Keychain Access. (I name mine MyAppCertKey.p12 to indicate that the file contains both the certificate and the key.)
Last, I wrote up a detailed explanation on testing / verifying communication with Apple's servers (from the terminal). It's a little complicated since you need to have some root certificates set up for openssl
to validate against; however, it will tell you if you are communicating correctly with the servers, without requiring any work on the receiving app itself.
无法连接到APNS沙盒服务器
希望有所帮助。