简体   繁体   English

如何使用APNs密钥(.p8)为iOS应用配置推送通知

[英]How to configure Push Notification for an iOS app using APNs key (.p8)

I'm trying to configure an app to use Push Notifications using Firebase. 我正在尝试将应用配置为使用Firebase使用推送通知。 From the firebase console, the recommended method to configure an ios app is to use a p8 certificate (APNs key). 在Firebase控制台中,推​​荐的配置ios应用程序的方法是使用p8证书(APNs密钥)。

I can create the p8 key from apple developer console, then upload it to Firebase for my app. 我可以从Apple开发人员控制台创建p8密钥,然后将其上载到我的应用程序的Firebase。

What seems to be missing is the part where I authorize my app to use Push Notifications. 似乎缺少的是我授权我的应用使用“推送通知”的部分。 From the apple console, the only option is to create development and production certificates, which are completely unrelated to the p8 key. 在Apple控制台中,唯一的选择是创建开发和生产证书,这与p8密钥完全无关。

How can I authorize push in my app using p8 key? 如何使用p8键授权在我的应用程序中推送?

Without a doubt the P8 is the best way to go. 毫无疑问,P8是最好的选择。

Apple insist that developers should use "Token Based Authentication" instead of the traditional P12 for push notification. 苹果坚持要求开发人员应使用“基于令牌的身份验证”代替传统的P12进行推送通知。

You should authorize your App, regardless, this a very easy and straightforward process. 无论如何,您都应该授权您的应用程序,这是一个非常简单直接的过程。 Both by activating the console switch and Enable the Push Notifications Capability on Xcode, I quote Apple: 通过激活控制台开关和在Xcode上启用推送通知功能,我引用了Apple:

Apps must have the proper entitlements to use push notifications. 应用必须具有适当的权利才能使用推送通知。 To add these entitlements to your app, enable the Push Notifications capability in your Xcode project 要将这些权利添加到您的应用中,请在您的Xcode项目中启用“推送通知”功能

在此处输入图片说明

And remember to match the certificates scope, classic mistake: Production = Production , etc. 并记住要匹配证书范围,经典错误: 生产=生产等。

Should you need any further assistance please reply or comment. 如果您需要任何进一步的帮助,请回复或评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM