firebase - 无法在 iOS 9.2 上接收 FCM 主题消息

标签 firebase push-notification firebase-cloud-messaging ios9.2 swift3.2

我编写了使用 FCM 主题按摩来接收来自服务器的推送通知的应用程序。

我的 HTTP 请求是:

https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{
"to":"/topics/Foo-bar",
"priority":"high",
"content_available": true,
"data":{
    "notification-type":"chat",
    "target":"Current User",
    "title":"Current User has sent you a message",
    "text": "hello1",
    "badge": 5  //Badge you want to show on app icon
   }
}

我得到的回复是:

{
"message_id": 6199072048907273657
 }

但它在设备上没有收到通知。

如何在调试器中打印通知数据?

最佳答案

有效负载应该是这样的。使用通知对象代替数据。

{
"to":"/topics/test",
"notification":{
    "type":"test",
    "title":"test!",
    "message":"test"
     }
}

关于firebase - 无法在 iOS 9.2 上接收 FCM 主题消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47996446/

相关文章:

ios - 使用 Firebase/Google Cloud Functions 推送通知

javascript - Firebase 调用 update() 数据库引用 javascript 时的路径无效

使用 node.js 进行 Firebase 存储/桶公开上传

android - ionic android 构建因异常而失败

javascript - 结合两个 promise

android - 通过单击来自 Parse 的推送通知打开 Activity

ios - 定义一个不会被取消引用的委托(delegate)?

android - 如何在尊重用户声音设置的情况下播放铃声?

swift - Xcode Swift Firebase Auth 使用电话号码和密码

ios - Firebase 崩溃报告不适用于 iOS 真实设备