如何生成有效的 APNS 证书 (.p12) 以在 GCM for iOS 中使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30602340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to generate valid APNS Certificate (.p12) for use in GCM for iOS?
提问by rajkumar
I am trying Google Cloud Messaging sample app for iOS platform. https://developers.google.com/cloud-messaging/ios/start
我正在尝试适用于 iOS 平台的 Google Cloud Messaging 示例应用程序。https://developers.google.com/cloud-messaging/ios/start
To generate GoogleServices-Info.plist APNS development and production certificates are needed (PKCS#12 file format). I have created .p12 file in MAC KeyChain Access (bundling both APNS dev certificate and private key).
生成 GoogleServices-Info.plist 需要 APNS 开发和生产证书(PKCS#12 文件格式)。我在 MAC KeyChain Access 中创建了 .p12 文件(捆绑了 APNS 开发证书和私钥)。
But when uploading the .p12 file, it says it is not in valid format (The certificate must be a valid PKCS12 file).
但是在上传 .p12 文件时,它说它的格式无效(证书必须是有效的 PKCS12 文件)。
回答by dam1
Here's my solution, without the terminal !
这是我的解决方案,没有终端!
delete your actual certificate ( in Keychain ) : "Apple Development IOS Push Service" & "Apple Production IOS Push Service"
Go to Apple Developer, Identifiers, App IDs, Select "YourApp", Edit, Push Notification and download the 2 certificates (dev & prod)
删除您的实际证书(在钥匙串中):“Apple Development IOS Push Service”和“Apple Production IOS Push Service”
转到 Apple Developer、标识符、App ID,选择“YourApp”、编辑、推送通知并下载 2 个证书(开发和生产)
import these 2 certificates in Keychain
in Keychain, go to "My Certificates", find the "Apple Development IOS Push Service" & "Apple Production IOS Push Service", click on the arrow to expand the Certificate + Key
Select both the the Certificate + Key, Right click "Export 2 items", you have your .p12 valid certificate ready for upload to GCM Services
在钥匙串中导入这 2 个证书
在Keychain中,进入“我的证书”,找到“Apple Development IOS Push Service”&“Apple Production IOS Push Service”,点击箭头展开Certificate + Key
选择证书 + 密钥,右键单击“导出 2 个项目”,您已准备好将 .p12 有效证书上传到 GCM 服务
This link helped me : http://faq.appaloosa-store.com/knowledgebase/articles/61785-how-to-generate-push-notification-p12-file
这个链接帮助了我:http: //faq.appaloosa-store.com/knowledgebase/articles/61785-how-to-generate-push-notification-p12-file
回答by Jessicardo
For anyone still having this issue, the solution for me was to not select both the key and the certificate for export - rather just export the certificate which ALREADY includes the key.
对于仍然存在此问题的任何人,我的解决方案是不要同时选择密钥和证书进行导出 - 而只是导出已经包含密钥的证书。
回答by rajkumar
This problem comes when we use Firefox to upload the .p12 file. In Chrome I am able to upload the same file.
当我们使用Firefox上传.p12文件时,就会出现这个问题。在 Chrome 中,我可以上传相同的文件。
回答by Abdul Karim
you can select only one also to export in .p12 format..
您也只能选择一个以 .p12 格式导出..
macApplication > Keychain Access > My Certificates > Export in .p12 format
macApplication > Keychain Access > My Certificates > Export in .p12 format