Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
420 views
in Technique[技术] by (71.8m points)

ios4 - Multiple push notifications on 1 device - iPhone

How to handle multiple push notifications on One device e.g:

A user receives a notification saying you have 1 new message from my app. Before he checks that message another message comes in so now he has 2. Well I don't want 2 messages stacked in the notification bar, I want 1 notification saying there are 2 messages waiting. How do I implement this?

And also if on device got 5 new notification and user taps last notification then how we got the previous notification userInfo

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Regarding your first question, you won't be able to do this. Notifications are seperate events, and NotificationCenter won't (and can't) merge them.

Push notifications aren't meant to deliver (much) information, hence, you cannot rely on reading the userInfo objects. For example, what would you do if the user just closes the notification alert and deletes it without reading it?

What you should do is only use Push notifications to tell your app that "something has happened". The app should then fetch the information from the server. I.e, if the user taps on the last notification, the app will still download all the information linked to all five notifications.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...