I implemented silent push notifications, but I noticed some strange behavior. Silent push notifications are processed through:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
Silent push messages, apparently, are only received if the device is charging (i.e. a cable is connected) and / or if my application is in the foreground.
If I disconnect the device from the charger (or Mac), quiet push notifications will no longer be accepted if the application is not in the foreground.
In both cases, I get non-silent push notifications.
If I plug in the USB cable again, I get the expected behavior, and silent push notifications are received regardless of whether the application is front or background.
I use UILocalNotification, so I know what it gets.
The fact that everything works perfectly with the connected device means that my quiet clicks of notifications are configured correctly and that the application has the correct background modes set in plist, etc.
This behavior is repeated on the iPhone 5s, 6 and iPad 2, running either on iOS 8 or 8.1.
Has anyone else experienced this? This should be easy to reproduce. Why does a simple way to connect the device to the charger change the ability to receive silent push notifications?
ios iphone background apple-push-notifications
user1024447 Nov 16 '14 at 16:49 2014-11-16 16:49
source share