[英]How to ensure that iOS app received EVERY push notification send by server?
It is widely known that: 众所周知:
How to solve this? 怎么解决这个?
n
notifications and implement them in the app at any time. 那么,我可以从服务器上下载最后n
通知,并随时在应用程序中实现它们。 The question is: 问题是:
How the server knows what notifications were implemented in the app, and which one not? 服务器如何知道在应用程序中实现了哪些通知,哪一个没有?
Notifications must be per device. 通知必须是每台设备。 Why? 为什么? For instance, notification "remove object from Core Data" must be implemented in every device. 例如,必须在每个设备中实现通知“从Core Data中删除对象”。 Because only one user can be logged in on multiply devices at time. 因为只有一个用户可以在多个设备上登录。
You should track the state of the task (delete record or whatever your app needs to do) on the server and have the client report back when the task is done. 您应该在服务器上跟踪任务的状态(删除记录或应用程序需要执行的任何操作),并在任务完成时让客户端报告。 Then flag the task as done. 然后将任务标记为已完成。
Don't use push notifications as a reliable delivery method for your tasks, you will fail. 不要将推送通知用作任务的可靠交付方法,否则您将失败。 Use the notifications as complementary part of your setup. 将通知用作设置的补充部分。
So for example when your app receives a notification, it can sync with the backend, to retrieve the tasks flagged as not done, execute them and then let the backend know that it's done. 因此,例如,当您的应用收到通知时,它可以与后端同步,检索标记为未完成的任务,执行它们,然后让后端知道它已完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.