Firebase 到 iOS APNS 消息 [英] Firebase to iOS APNS messages

本文介绍了Firebase 到 iOS APNS 消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个对开发社区来说有点新闻的问题.

This is a question with a bit of news to the dev community.

我将消息从 AWS SNS 发送到 Firebase,然后它应该被路由到 GCM 和 APNs.

I send messages from AWS SNS to Firebase, wherefrom it is supposed to be routed to both GCM and APNs.

  • GCM 消息顺利通过.
  • 新闻部分:与 Apple 开发人员指南的所有声明相反,我在 Mac 上的模拟器在 firebase 上注册,获取注册令牌,然后接收通过 Firebase 发送的通知.它不会自动在通知中心显示它们,但我从 applicationReceivedRemoteMessage() 函数手动创建通知显示作为 UILocalNotification(),所以现在它甚至在通知中心显示它们 - 非常出乎意料,但它可以工作.
  • 当我在真正的 iPhone 上安装应用程序时,没有收到消息.并不是说它们没有显示 - 该函数从未被调用.

  • GCM messages pass without any problem.
  • News part: Contrary to all statements by Apple developer guides, my simulator on Mac registers on firebase, gets registration token and then receives notifications sent via Firebase. It does not display them in the notification center automatically, but I create notification display manually from the applicationReceivedRemoteMessage() function as UILocalNotification(), so now it even displays them in notification center - highly unexpected but it works.
  • When I install the app on a real iPhone, the messages are not received. Not that they are not displayed - the function is never called.

我在 Firebase 上的 .p12 密钥是推送证书的私钥,如下所述:https://firebase.google.com/docs/cloud-messaging/ios/certs

My .p12 keys on the Firebase are the private key of push certificates as described here: https://firebase.google.com/docs/cloud-messaging/ios/certs

SO 上有几个问题讨论了无法接收 APNs 消息的问题,但在这里我们有一个特别小的出错空间(对其他开发者来说是个好消息):

There are several questions on SO discussing this issue of not receiving APNs messages, but here we have an especially narrow room for error (and some good news for other developers):

  • 模拟器接收消息,所以我的代码iOS代码一定没问题.
  • Android 应用接收消息,以便 AWS SNS 到 Firebase 的路由正常工作.
  • 因此,该问题仅与 Firebase 和 iOS 相关,很可能与配置文件/密钥有关.
  • 我使用手动创建的配置文件

尝试将完整的推送证书导出为 .p12 并添加到 Firebase,但效果不佳.

Tried to export complete push certificate as .p12 and add to Firebase but it does not work as well.

关于什么可能是错误的/值得检查的任何建议?

Any suggestions as to what can be wrong/worth checking?

推荐答案

原来问题中引用的 Firebase 说明不正确 - 不是将推送证书的私钥导出为 .p12,而是导出完整的证书.上传到 Firebase 即可使用.

Turns out Firebase instructions referenced in the question are incorrect - instead of exporting the private key of push certificate as .p12, export the complete certificate. Upload to Firebase and it will work.

这篇关于Firebase 到 iOS APNS 消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆