本文介绍了当 APNS 仅存储一条通知时,whatsapp 如何在设备离线时收到多条通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 Apple 官方文档,APNS(Apple 推送通知服务)仅在设备离线时存储最后一条通知.

According to the official Apple documentation, APNS (Apple Push Notification Service) stores only the last notification if the device is offline.

Apple 推送通知服务包括默认的服务质量(QoS) 组件,执行存储和转发功能.如果 APNs尝试发送通知但设备处于离线状态,QoS存储通知.它每个只保留一个通知设备上的应用程序:最后一次收到的通知该应用程序的提供商.当离线设备以后重新连接,QoS 将存储的通知转发到设备.QoS 会在删除之前保留通知一段有限的时间

那么当设备上线时,whatsapp 之类的应用程序如何从多个用户发送消息?如果设备在线,这些消息将作为单独的通知接收.

Then how do apps like whatsapp send messages from multiple users when the device comes online? Those messages would have been received as separate notification if device was online.

推荐答案

似乎在 iOS 8 上对这个问题进行了更新,即使您的用户手动杀死,您的应用程序也会因推送而在后台唤醒它.看看这个:在 iOS8 中使用 PushKit 在后台唤醒您的应用.

It seems like there was an update to this issue on iOS 8 that will allow your app to wake up in the background due to push even if your user manually killed it. Check this out: Wake your app in the background using PushKit in iOS8.

这意味着您可以向您的应用发送通知,一旦它重新连接,它就会被操作系统唤醒并能够与您的服务器进行通信.然后,您可以实现将设备离线时错过的所有推送消息发送给它的逻辑.

This means that you can send notifications to your app and once it's re-connected, it will be woken up by the operating system and will be able to communicate with your server. Then, you can implement the logic to send it all of the push messages that were missed while the device was offline.

我不得不承认我自己还没有尝试过,但听起来这可能是您所描述问题的解决方案.

I have to admit that I have yet to try it out myself, but it sounds like this might be the solution to the issue you're describing.

这篇关于当 APNS 仅存储一条通知时,whatsapp 如何在设备离线时收到多条通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 23:40