Multiple push notifications on 1 device - iPhone

How to handle multiple push notifications on one device, for example:

The user receives a notification that you have 1 new message from my application. Before he checks this message, another message will appear, so now he has 2. Well, I do not want 2 messages to be written in the notification panel, I want 1 notification to say that there are 2 messages. How to implement this?

And also, if 5 new notifications and user branches of the last notification appeared on the device, then how did we get the previous userInfo notification

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 
+7
source share
1 answer

As for your first question, you cannot do this. Notifications are separate events, and NotificationCenter will not (and cannot) combine them.

Push notifications are not intended to deliver (a lot) of information, therefore, you cannot rely on reading userInfo objects. For example, what would you do if the user simply closed the notification and deleted it without reading it?

What you need to do is use push notifications to tell your application that "something happened." Then the application should extract information from the server. Ie, if the user selects the last notification, the application will still download all the information associated with all five notifications.

+2
source

All Articles