Swift中未收到设备的无声推动通知
当我发送通知时。我在设备上随机收到通知。 我正在向5个设备发送通知。现在,有3个设备收到通知,而2个设备未收到。
- 当该应用在前景中运行时,我将在所有设备中收到通知。
- 当应用在后台时,我会收到通知。
- 当应用程序被用户杀死,甚至电话被锁定时,我没有在几个设备中收到任何通知,也没有在其他设备中收到。
现在,当我打开应用程序时,我立即收到通知。 我阅读了Apple Doc的一篇文章有关无声推动通知的文章,并清楚地提到没有保证向设备传递通知。
我无法使用正常通知,因为在向用户显示的通知之前,我正在过滤数据。如果有效载荷具有等于存储的设备ID的设备ID,则我发出了本地通知,如果没有,则通知是无声的。 这个问题有任何解决方案吗?
When I send the notification. I am getting the notification randomly on the devices.
I was sending notification to 5 devices. Now 3 devices were receiving the notification and 2 device didn't received.
- When the app is running in the foreground I am getting notification in all devices.
- When app is in background I am getting notifications.
- When app is killed by the user and even phone is locked I didn't receive any notification in couple of devices and received in other device.
Now, when I open the app I immediately received the notification.
I read an article from apple doc on silent push notification and there it is clearly mentioned that there is no guarantee of notification delivery to the device.
I cannot use normal notifications because I am filtering data before the notification shown to user. If payload have device id which is equal to stored device id then I fired a local notification if not then notification is silent.
Any solution for this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用UnnotificationServiceExtension,该文章允许在交付给用户之前修改远程通知内容。 Here is the reference link : https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension< /a>
You can use UNNotificationServiceExtension which allows modification of a remote notification content before its delivered to the user. Here is the reference link : https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension