didReceiveRemoteNotification not called in iOS 13.3 when app is in background

I am banging my head. I am implementing push notification. Everything is working fine (push is received, badge is updated) but under iOS 13.3 the method application(_:didReceiveRemoteNotification:fetchCompletionHandler:) is not called when the app is in the background. If the app is in the foreground or using an iOS 12 device the method is called. I register for push notification in the following way (yes, it is still Objective C)


[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) {
  if (granted) {
  dispatch_async(dispatch_get_main_queue(), ^{
  [[UIApplication sharedApplication] registerForRemoteNotifications];
  });
  }
}];


The payload is set to the following:


{"aps": {
  "badge": 10,
  "alert": "test",
  "content-available": 1
}}


I tried adding "Remote notifications" and "Background processing" as app capabilities in all variations (only "Remote notifications"/"Background processing", without any of those capabilities, enabling both) without any change. I set the delegate for the UNUserNotificationCenter but again without success. I set the headers accordingly:


curl -v \
 -H 'apns-priority: 4' \
 -H 'apns-topic: xx.xxxxx.xxxx' \
 -H 'apns-push-type: alert' \
 -H 'Content-Type: application/json; charset=utf-8' \
 -d '{"aps": {"badge": 10,"alert": "test", "content-available":1}}' \
 --http2 \
 --cert pushcert.pem \
 https://api.sandbox.push.apple.com/3/device/1234567890


From the docs it states that this method is called even when the app is in background:


Use this method to process incoming remote notifications for your app. Unlike the application:didReceiveRemoteNotification: method, which is called only when your app is running in the foreground, the system calls this method when your app is running in the foreground or background.


I tried with and without background modes (Remote Notification, Background processing, Background fetch) but without success. If I use an iOS 12 device, the method is called.


My goal is to process some of the information in the payload (there might be additional information).

What am I missing here for iOS 13 (13.3 to be exact)?

Interesting investigation, checked all things - but facing same issue. following input:

  • iPhone 7+
  • iOS 15.5
  • push notification and background refresh is allowed from app
  • battery is 100% ( low-power mode not activated )
  • Background modes checked: background fetch, remote notification
  • Push capabilities added (Remote notification, Background processing, Background fetch)

postman requests successful - 200 in response, but not trigger didReceiveRemoteNotification: `{ "to": "{{fcmToken}}", "yourCustomKey":"1", "aps":{ "content-available":1, "apns-priority":5, "sound": "", "apns-push-type":"background", "badge":0} }

{ "to": "{{fcmToken}}", "yourCustomKey":true, "aps":{ "content-available":true, "apns-priority":5, "sound": "", "apns-push-type":"background", "badge":0} }

{ "to": "{{fcmToken}}", "yourCustomKey":true, "aps":{ "content-available":true, "apns-priority":5, "sound": "default", "apns-push-type":"background", "badge":0} } ` and even that doesn't trigger didReceiveRemoteNotification Listing 7-1 shows an example of a JSON payload for a background update notification.  developer.apple.com

{ "to": "{{fcmToken}}", "aps" : { "content-available" : 1 }, "acme1" : "bar", "acme2" : 42 } Nothing from requests above works.

Yes I did reload iPhone

Any suggestion?? Hot to t-shoot next?

Try my below sample payload.

Add "content-available": 1 line in your payload.

{

"aps": {

	"alert":  "Game Request", 

    "sound": "default",

    "content-available": 1

}

}
didReceiveRemoteNotification not called in iOS 13.3 when app is in background
 
 
Q