1设备上的多个推送通知 - iPhone [英] Multiple push notifications on 1 device - iPhone

查看:225
本文介绍了1设备上的多个推送通知 - iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何处理一个设备上的多个推送通知例如:

一个用户收到通知说你必须从我的应用程序1条新信息。他会检查消息的另一个消息到达之前,所以现在他拥有2好吧,我不想堆放在通知栏2的消息,我想1通知说有2个消息等待。如何实现这一点?

和还对是否有设备5个新的通知和用户水龙头最后的通知,然后我们是如何走到了previous通知用户信息

   - (无效)应用:(*的UIApplication)的应用didReceiveRemoteNotification:(NSDictionary的*)USERINFO


解决方案

关于你的第一个问题,你将无法做到这一点。通知是单独的事件,并通知中心不会(也不能)合并。

推送通知并不意味着交付(多)的信息,因此,你不能靠阅读用户信息的对象。例如,你会怎么做,如果用户只需关闭该通知提醒,并删除它没有读它?

你应该做的是只使用推送通知要告诉你的应用程序,出事了。然后,应用程序应该从服务器获取的信息。即,如果用户点击了最后的通知,应用程序仍然会下载链接到所有五个通知的所有信息。

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

解决方案

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.

这篇关于1设备上的多个推送通知 - iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆