Heena
Heena

Reputation: 2358

Push notification not appearing in notification tray

I am facing one unusual issue that my notification is not coming in notification tray. Though I am getting sound and begde count too. So there should not be any problem with provisioning profile. I am not able to find anything with googling.

I have tested this case when app is in background and killed.

I have checked in settings also for my application its banner is selected.I also try with alerts but alerts are not appearing.

Any idea about this issue?

NSDictionary *userInfo = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];

I am getting this userInfo = nil Is this the issue notification not appearing in notification bar?

Upvotes: 0

Views: 1603

Answers (2)

Anthonius
Anthonius

Reputation: 340

For those who are using FCM Push Notif, might need to check wheter the payload has "notification" field there. Here is the example of full payload working with FCM:

{ 
"registration_ids" : ["xx5MSpbpuUe6lgYhXTX-gs:APA91bFxKmDCTlE2WA_hl29XjiNK7A-qpdRBJaz-JddCsx5CAxxxxxxxxxxGcoO0-moOMqT2T59cExxxxxt-uMgLUQgg4t8jL3uuccka6psdBXVl26bx2HfnSbvKAxxxxxx-x_xxxxx_"],
"priority": "high",

"data" : {
    "app_link": "xyz://abc/def/123/456",
    "title": "Testing",
    "icon": "htt://abc/image.png",
},
"notification": {
    "body": "Notification body",
    "title": "Here is the title",
    "subtitle": "and this is subtitle",
    "sound" : true,
    "content_available": true,
    "mutable_content": true,
    "priority": "high",
    "badge": "1"
}

}

Upvotes: 0

Heena
Heena

Reputation: 2358

Finally I got the issue and that was from server side. Might be one of the same case for others too..

aps =     {
   alert =         {
        dictioanry =             {
            key = value;
            key = value;
        };
    };
    badge = 1;
    sound = default;
}; 

Here I asked the php person to add body tag and I was able to get notifications in tray..

So for the people with same issue just check out if you are missing any key from the server side.

Upvotes: 2

Related Questions