application:didReceiveRemoteNotification:fetchCompletionHandler not called on iOS 11

Hi,

I'm relying in the UIApplicationDelegate method "application:didReceiveRemoteNotification:fetchCompletionHandler" to receive some silent notifications when the application is not in the foreground.


With iOS 11 beta 1, this method is no longer called when I send this push payload


{
  "aps": {
    "content-available": 1
  },
  "mydata": {
    "foo": "bar"
  }
}



- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
}


Did anybody else noticed this behaviour?

Replies

Yes, I agree with abras. At the beginning it is working fine, but in some point the iOS (beta3) stops to wake my app. And after that only if you connect the phone to the charger, it works. But disconnecting from charger it stops again.


The divice reboot issue seems to be solved.

I aggree, iOS 11.1 beta3, not stable, it works sometime and will stop working at some point.

I have a question, does non-silent push notifications work for you guys? Or do you also see the same behavior as with silent notifications?

Yes. It's still happening on Beta 4. And it's not only on my app. I've been losing a lot of messages on WhatsApp due to this bug. On 11.0 it never worked. On iOS 11.1 it only works when your device has a lot of battery left or is connected to power.


Basically there is a new process called Duet on iOS 11, that gives each app a score. If your apps uses a lot of energy, or receives silent notifications many times in sequence, Duet discards the push notification or delays when it will be delivered. This all sounds extremely nice and good for the user. The problem starts when Duet triggers these behaviors and also stop calling the app in foreground or after being plugged to power. The foreground behavior can be worked around by implementing:


- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {


But there is no workaround for when the app is running in background mode. My app runs on iOS 9 and iOS 10. All of them still works great. On iOS 11 it simply doesn't.

Not totally fixed in iOS 11.1 Beta 5 neither.


At first everything appears to be working - pushes are delivered to the app immediately if running in the background or the foreground. But then if pushes are sent where the priority and expiry are different from the previously sent pushes, then they stop getting delivered. If the priority and expiry values are put back to their original then the pushes are still not being delivered.


So its an improvement but there are still issues in it

IOS 13 following method not called

 func userNotificationCenter(_ center: UNUserNotificationCenter,
                didReceive: UNNotificationResponse,
                withCompletionHandler: @escaping ()->()) {
    withCompletionHandler()
  }

It should be call when app is in background and user want to perform some action , it is called when user tap on it

I am using Xcode Version 11.6 (11E708)

I want to perform some task when app in background , how can i do , can anyone please help ?