ios 如何在 Firebase 控制台中为 APNs 使用 Apple 的新 .p8 证书
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39672297/
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 use Apple's new .p8 certificate for APNs in firebase console
提问by Subso
With the recent up gradation of the Apple developer accounts, I am facing a difficulty that while trying to create the push notification certificates, it is providing me with (.p8) certificate instead of APNs ones which can be exported to (.p12).
随着最近 Apple 开发人员帐户的升级,我面临一个困难,即在尝试创建推送通知证书时,它为我提供 (.p8) 证书而不是可以导出到 (.p12) 的 APNs 证书。
Firebase console only accepts (.p12) certificates so how I can get that out from these new (.p8) certificates.
Firebase 控制台只接受 (.p12) 证书,所以我如何从这些新的 (.p8) 证书中获取它。
回答by John Idasetima
I was able to do this by selecting "All" located under the "Keys" header from the left column
我可以通过选择位于左列“键”标题下的“全部”来做到这一点
Then I clicked the plus button in the top right corner to add a new key
然后我点击右上角的加号按钮添加一个新键
Enter a name for your key and check "APNs"
为您的密钥输入名称并选中“APNs”
Then scroll down and select Continue. You will then be brought to a screen presenting you with the option to download your .p8 now or later. In my case, I was presented with a warning that it could only be downloaded once so keep the file safe.
然后向下滚动并选择继续。然后您将被带到一个屏幕,向您展示现在或以后下载您的 .p8 的选项。就我而言,我收到了一个警告,提示它只能下载一次,因此请确保文件安全。
回答by Hardik Shah
Apple have recently made new changes in APNs and now apple insist us to use "Token Based Authentication" instead of the traditional ways which we are using for push notification.
苹果最近对 APN 进行了新的更改,现在苹果坚持我们使用“基于令牌的身份验证”,而不是我们用于推送通知的传统方式。
So does not need to worry about their expiration and this p8 certificates are for both development and production so again no need to generate 2 separate certificate for each mode.
所以不需要担心它们的过期,这个 p8 证书用于开发和生产,所以再次不需要为每种模式生成 2 个单独的证书。
To generate p8 just go to your developer account and select this option "Apple Push Notification Authentication Key (Sandbox & Production)"
要生成 p8,只需转到您的开发者帐户并选择此选项“Apple Push Notification Authentication Key (Sandbox & Production)”
Then will generate directly p8 file.
然后会直接生成p8文件。
I hope this will solve your issue.
我希望这能解决你的问题。
Read this new APNs changes from apple: https://developer.apple.com/videos/play/wwdc2016/724/
阅读来自苹果的这个新的 APNs 变化:https: //developer.apple.com/videos/play/wwdc2016/724/
Also you can read this: https://developer.apple.com/library/prerelease/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html
您也可以阅读:https: //developer.apple.com/library/prerelease/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html
回答by Subso
So, After taking a while I figured out that the old push certificate generating service also exists.
因此,经过一段时间后,我发现旧的推送证书生成服务也存在。
You get two options:
你有两个选择:
- Apple Push Notification Authentication Key (Sandbox & Production)
- Apple Push Notification service SSL (Sandbox & Production)
- Apple 推送通知身份验证密钥(沙盒和生产)
- Apple 推送通知服务 SSL(沙盒和生产)
Those who want to achieve the old style .p12 certificate can get it from second option. I have not used the first option yet as most of the third-party push notification service providers still need the .p12 format certificate.
那些想要获得旧式 .p12 证书的人可以从第二个选项中获得。我还没有使用第一个选项,因为大多数第三方推送通知服务提供商仍然需要 .p12 格式的证书。
回答by dharmendra vaishnav
回答by Krunal
Follow these steps:
按着这些次序:
1. Generate an APNs Auth Key
Open the APNs Auth Key page in your Developer Center and click the +button to create a new APNs Auth Key.
1. 生成APNs Auth Key
在开发者中心打开APNs Auth Key页面,点击+按钮创建新的APNs Auth Key。
In the next page, select Apple Push Notification Authentication Key (Sandbox & Production) and click Continue at the bottom of the page.
在下一页中,选择 Apple Push Notification Authentication Key (Sandbox & Production),然后单击页面底部的 Continue。
Apple will then generate a .p8
key file containing your APNs Auth Key.
然后 Apple 将生成一个.p8
包含您的 APNs Auth Key的密钥文件。
Download the .p8
key file to your computer and save it for later. Also, be sure to write down the Key ID somewhere, as you'll need it later when connecting to APNs.
将.p8
密钥文件下载到您的计算机并保存以备后用。此外,请务必在某处写下密钥 ID,因为稍后连接到 APN 时您将需要它。
2. Send Push Notifications
2. 发送推送通知
Ref: APNS (Configure push notifications)
参考:APNS(配置推送通知)
Important:Save a back up of your key in a secure place. It will not be presented again and cannot be retrieved later.
重要提示:将您的密钥备份保存在安全的地方。它不会再次出现,以后也无法检索。
回答by bibscy
When you upload your p8 file in Firebase, in the box that reads App ID Prefix(required), you should enter your team ID. You can get it from https://developer.apple.com/account/#/membershipand copy/paste the Team ID as shown below.
当您在 Firebase 中上传 p8 文件时,在显示App ID Prefix(required)的框中 ,您应该输入您的团队 ID。您可以从https://developer.apple.com/account/#/membership获取 并复制/粘贴团队 ID,如下所示。
回答by Dody
You can create the .p8 file for it in https://developer.apple.com/account/
您可以在https://developer.apple.com/account/ 中为其创建 .p8 文件
Then go to Certificates, Identifiers & Profiles > Keys > add
然后转到证书、标识符和配置文件 > 密钥 > 添加
Select Apple Push Notification service (APNs), put a Key Name (whatever).
选择 Apple 推送通知服务 (APNs),输入密钥名称(随便)。
Then click on "continue", after "register" and you get it and you can download it.
然后点击“继续”,“注册”后就可以下载了。