zavrina
zavrina

Reputation: 305

Swift - Push Notification JSON format

Please let me ask about Push Notification issue here.

Our server sent out the data in JSON format like this

{
"notification":

    {
    "body”:”Test Push Notification (42)”,
    "node":"1233837”,
    "content-available":"1"
    },
    "priority":"high"

}

The process of sending out push notification to our app is

But when we receive push notification in our app, the format is totally changed (as shown in attached image).

enter image description here

If you face with this kinda issue before, could you share with how to solve it, please?

Or is there any way to change in GCM to get normal JSON format?

Upvotes: 1

Views: 2881

Answers (1)

Srj0x0
Srj0x0

Reputation: 456

Try next format to send notification to GCM:

{ "notification": { "body”:”Test Push Notification (42)”, "node":"1233837” }, "priority":10, "content-available":true }

From APNS you app get some like this

{
  aps:{
       alert:{
                   *bla bla bla*
        }, 
        *bla bla bla*
 }}

Just parse it in didReceiveRemoteNotification: method.

Upvotes: 1

Related Questions