0

Here is notification payload:

{ 
 "aps": {
   "content-available": "1"
  }, "data": {
     "ct_typ": "1",
     "imp": "0",
     "msg_id": "1532071410494",
     "msg_typ": "0",
     "user_id": "11136cb83e"
 }}

Following method I used and get notification in background mode but this method is not working in Not Running(Kill Mode).

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {}

I am working with XMPP and i need to reply delivered message on Not Running(kill mode).

Prashant Tukadiya
  • 15,838
  • 4
  • 62
  • 98
  • Why are you using silent notification? You should use normal notification and create notification content extension. From there you can replay to the sender regarding message delivery. – rv7284 Jul 25 '18 at 05:35

2 Answers2

2

Silent notification won't work if the application is forced kill by the user. You should use normal notification for that purpose. This way even if your app is killed notification for the new message will be displayed.

And by creating Notification service extension you will have control even if your app is killed.

Notification service extension take a look here for more info.

rv7284
  • 1,092
  • 9
  • 25
  • I have implement Notification Service Extension and got notifications but the Service Extension method does not call for download content. So can you help me for this what i am missed. – Deepak Sankala Jul 27 '18 at 05:50
  • if you want to download something on the notification. You can do that you can even install pods for the extension. but to pass data between your application and extension you will need to use Group user default. – rv7284 Jul 27 '18 at 06:58
0

From iOS 10 and later, You have use UIUserNotification delegate methods for latest OS. Delegate method to receive notification in active as below. I think you have use older code for notification.

func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent
    notification: UNNotification, withCompletionHandler completionHandler:
    @escaping (UNNotificationPresentationOptions) -> Void) {

    return completionHandler(UNNotificationPresentationOptions.alert)
}

How to implement Remote notification for iOS 10 and later.

Hitesh Surani
  • 12,733
  • 6
  • 54
  • 65