如何在iPhone上处理iPad上的一个无效的iOS推送通知? [英] How to invalidate an iOS push notification on iPad when handled on iPhone?

查看:149
本文介绍了如何在iPhone上处理iPad上的一个无效的iOS推送通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们假设一个用户对他们的iPhone和iPad上的消息应用程序。他们得到了新的消息,从服务器,所以推通知被发送给他们的设备。现在,用户拿起自己的iPhone和读取通知中心等候消息。我现在该如何对他们的iPad移除通知中心消息(和应用证件号码),因为它已经被读?

Let's say a user has a messages app on their iPhone and iPad. They get a new message from the server, so a push notification is sent to both their devices. Now the user picks up their iPhone and reads the message waiting in notification center. How do I now remove the message from notification center (and the app badge number) on their iPad, since it's already been read?

推荐答案

当用户(轻敲通知或应用程序的启动图标后presumably)读取iPhone上的信息,您可以执行一些API打电话给你的服务器上,通知其用户阅读邮件。

When the user reads the message on the iPhone (presumably after tapping on the notification or the launch icon of the app), you can execute some API call on your server to notify it that the user read the message.

如果您在您的服务器为每个用户都属于该用户的设备的设备令牌列表维护,您可以发送推送通知到所有这些设备与徽章计数为0这将清除iPad上的证件号码(和任何其他设备属于该用户)。我不知道它是否会从iPad的通知中心删除消息,虽然。

If you maintain in your server for each user a list of device tokens of all the devices belonging to that user, you can send a push notification to all those devices with badge count 0. This will clear the badge number on the iPad (and any other devices belonging to that user). I'm not sure whether it would remove the message from the notification center of the iPad, though.

这篇关于如何在iPhone上处理iPad上的一个无效的iOS推送通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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