简体   繁体   中英

Silent Push Notification is not received to the device in swift

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM