如何生成有效的APNS证书(.p12)以用于iOS的GCM?

raj*_*mar 22 pkcs#12 apple-push-notifications ios google-cloud-messaging

我正在尝试iOS平台的Google Cloud Messaging示例应用.https://developers.google.com/cloud-messaging/ios/start

要生成GoogleServices-Info.plist,需要APNS开发和生产证书(PKCS#12文件格式).我在MAC KeyChain Access中创建了.p12文件(捆绑了APNS开发证书和私钥).

但是在上传.p12文件时,它表示它的格式不正确(证书必须是有效的PKCS12文件).

dam*_*am1 51

这是我的解决方案,没有终端!

  • 删除您的实际证书(在Keychain中):"Apple Development IOS Push Service"和"Apple Production IOS Push Service"

  • 转到Apple Developer,Identifiers,App ID,选择"YourApp",编辑,推送通知并下载2个证书(dev&prod)

在此输入图像描述

在此输入图像描述

  • 在Keychain中导入这两个证书

  • 在Keychain中,转到"我的证书",找到"Apple Development IOS Push Service"和"Apple Production IOS Push Service",单击箭头展开Certificate + Key

  • 选择证书+密钥,右键单击"导出2个项目",即可将.p12有效证书准备好上传到GCM服务

在此输入图像描述

在此输入图像描述

这个链接帮助了我:http://faq.appaloosa-store.com/knowledgebase/articles/61785-how-to-generate-push-notification-p12-file

  • 关键是在导出到.p12之前选择证书和密钥.至少在我的情况下这已经足够了. (3认同)

raj*_*mar 1

当我们使用Firefox上传.p12文件时,就会出现这个问题。在 Chrome 中我可以上传相同的文件。