I've read about the woes of silent push notifications in iOS, so this will likely be fruitless ... but I figure I'll ask if only to just maybe have an Apple rep see it.
I'm sending a simple APNS message to an iOS 8.1 app:
aps: {
content-available: 1,
priority: 5
}
The app is in the background (read: I have not force-closed it).
Sometimes my app delegate's didReceiveRemoteNotification
with fetchCompletionHandler
fires, sometimes it doesn't. I can tell because I am monitoring my server and can see if/when a GET request arrives.
I'm currently exploring if there's a correlation with passing weather systems and/or bird migration patterns.
But what's really frustrating is that when I build/launch my app via xCode, here's the console output:
- appDelegate: received notification
- appDelegate: fetching stories
- appDelegate: application launched
- appDelegate: remote notifications approved
**** modal view controller: viewDidLoad
Notice the notification is "received" just as xCode is firing up the app, but before the application launches (?).
It's as though the device is receiving silent notifications but is sitting on them until xCode starts the app. Additionally, I've noticed that when the device is running the app & connected to xCode, silent push notifications arrive very reliably ... which would also suggest some sort of irregularity involving xCode.
Am I doing something wrong? Is anyone else seeing this phenomenon? Or is this just a bug with iOS / APNS?
I'm happy to try out any code snippets or suggestions anyone has! Thank you.