iosbackgroundpush-notificationwifi4g

iOS UIBackgroundMode remote-notification doesn't work on 4G


I'm testing push notifications with content-available=1, and they don't seem to be delivered to the app in the background unless on Wi-Fi.

I have a simple log statement at the beginning of the push notification handler:

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

    NSLog(@"Notification received: %@", userInfo);
    completionHandler(UIBackgroundFetchResultNewData);
}

Here is my test:

  1. Run the app, then press the home button to put the app in the background.
  2. Send a push notification with content-available=1
  3. Watch console logs

On Wi-Fi, the console log shows the notification. If I go to Settings and turn off Wi-Fi, switching to 4G, notifications no longer appear in the log (although they do slide in at the top of the screen, so I know they are being delivered).

There are no crash logs, and the notification is logged if I manually tap on it. Furthermore, this problem does NOT occur if I am debugging the app in Xcode. (i.e., if I am debugging in Xcode, the app will receive the notification in the background on 4G). Has anyone else experienced this behavior? Or am I doing something wrong?

EDIT: To be specific: according to my tests, if the following conditions are true, then the remote notification delegate method above will not be called:

  1. App is running in the background
  2. Phone is on LTE network, not connected to Wi-Fi
  3. App is NOT running in the Xcode debugger
  4. Notification with content-available=1 is received by the phone

However if condition 2 is removed (i.e., the phone is connected to Wi-Fi), then the handler will be called.


Solution

  • Based on feedback from a commenter here and repeated testing on multiple devices, this appears to be a bug (or intended behavior) on iOS.