问题描述
我基本上想在在iOS的通知栏看到同一应用程序的多个推送通知。
I basically want to make multiple push notifications in the same application visible in the notification tray in iOS.
如果我的数据上,而推送通知是通过APNS触发,但只有最近的一次是在情况下,我下线和我走过了一段时间后回来接受此方案适用。此功能是通过APNS文件建立的肯定。
This scenario works if my data is on while push notification is triggered via APNS, but only the latest one is received in case I am offline and come back after a while. This functionality is affirmed by APNS documentaion.
然而,这就是发生在WhatsApp的工作:
However, this is what worked in WhatsApp:
- 转身数据连接关闭
- 发一些消息的WhatsApp
- 转身数据连接
- 看到了苹果的通知托盘收到多个推送通知
如何工作的这种情况?我可以使用APNS这个?如果是,那么如何?
How's this scenario working? Can I use APNS for this? If yes, then how?
请参阅。
推荐答案
就像你在你的问题中写道,这是在苹果文档中提到:
Like you wrote in your question, this is mentioned in the Apple Docs:
如果您要发送多个通知到同一设备或
很短的时间周期内的计算机,所述推送业务将发送
只有最后一个。
链接
在仅的场景,你所描述的工作会是什么,如果你的WhatsApp在后台打开,而得到那些推送通知
。这样的WhatsApp将处理它们为本地通知
,将present所有的人都在通知中心。如果WhatsApp的被关闭,你会得到只有像任何其他应用程序的最后通知。
The only scenario that what you're describing will work is if your whatsApp was open in the background while getting those push notifications
. That way whatsApp will handle them as local notifications
and will present all of them in the notification center. If whatsApp was closed you'd get only the last notification like any other app.
您可以轻松地测试这一点:
You can easily test this:
- 终止WhatsApp的,打开
飞行模式
。 - 发送设备5的消息,从1到5。
- 打开
飞行模式
关闭并锁定您的设备。 - 您只会看到一个MSG在
的通知中心
。 (你送又名5最后一个)
- Terminate whatsApp and turn on
Airplane mode
. - Send your device 5 messages from 1 to 5.
- Turn
Airplane mode
off and lock your device. - You'll only see one msg (the last one you sent aka "5") in your
notifications center
.
这是怎么了WhatsApp是使它工作:
虽然WHATSAPP是在背景中,单个推通知被接收(最后一个发送的用户,5在我们的例子)。味精不会显示给用户。
While whatsApp is in the background, a single push notification is received (the last one the user sent, "5" in our example). That msg will not be shown to the user.
WhatsApp的接收它的方法应用程序:didReceiveRemoteNotification:fetchCompletionHandler:
和反对他们的服务器检查是否存在以5,用户没有收到任何事先通知。如果是这样的话,他们会拉从他们的服务器的数据,并使用本地通知
将美元的使用者P $ psent它基本上是只是一种present数据并没有涉及到APNS的。
whatsApp receives it in the method application:didReceiveRemoteNotification:fetchCompletionHandler:
and checks against their servers if there are any notifications prior to "5" that the user didn't receive. If that's the case, they will pull that data from their servers and will present it to the user using local notifications
which is basically just a way to present data and not related to APNS at all.
这篇关于苹果多次推送通知的通知托盘中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!