2

Let there are 5 remote notifications recived for my app. Whenver I tap on single notification all 5 notification are disappaering too, we need to show other 4 notifications intact until they tapped. But main issue is all other notifications are for other purpose not for the same purpose. So we need to show all notification until they are clicked from the notification tray.

Also we need to update the badge count according to this. Is there any way to handle remote push notification when app is not running (killed)? Could you please suggest better way to handle remote push notifications using objective c ?

Thanks

Soumen Pal
  • 39
  • 2

3 Answers3

1

You must be removing the all notifications or assigning badge count to zero or both, Once you receive the notification in your app push notification receiving delegate method like that:

UIApplication.sharedApplication().applicationIconBadgeNumber = 0
UIApplication.sharedApplication().cancelAllLocalNotifications() 

if in your single push notification receiving handling have above code lines then it will remove the other notifications for the application from the notification tray of iOS.

In Objective C the above code lines are as:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
Anuj
  • 820
  • 4
  • 11
0

It sounds like you might be setting the applicationIconBadgeNumber to 0 which will clear out all the other notifications. [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];

See the following post for more details on the application number All notifications disappearing after opening one of them

To set the correct badge number you can detect that a notification was clicked update the badge count accordingly. Or you can even pass the badge number down to the app in the apns payload.

See other threads: https://forums.developer.apple.com/thread/62137

Community
  • 1
  • 1
David Truong
  • 462
  • 4
  • 13
-1

For showing badge count make sure you are posting badge count while sending notification from server :-

            $body = array('aps' => array('alert' => $message,'badge' =>'$badgecount', "sound"=> "Default"));
Amandeep Singh
  • 746
  • 5
  • 4