我编写了使用 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/