firebasepush-notificationfirebase-cloud-messagingios9.2swift3.2

Unable to receive FCM Topic Messaging on iOS 9.2


I wrote application which uses FCM topic massaging to receive push notifications from server.

My HTTP request is:

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
   }
}

And I got response as:

{
"message_id": 6199072048907273657
 }

But it doesn't receives Notification on device.

And how to print Notification data in debugger??


Solution

  • Payload should be like this. Instead of data use notification object.

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