Some users are telling me they "never" or rarely get alerts sent by my app while in the background. I have no such problem on my phone - I get alerts frequently. I've checked every setting we can find related to background app refresh, and to notifications, but all seems in order.
My app (AirCompare) does background fetches, processes a small amount of web data, and then sends an alert. This all works fine for me and most users. In the case of the affected user, my app logging shows that alerts were requested, but the user never saw them.
Here's an example alert, one relaed to the weather:
requestIdentifier = "Tickle Weather"
content.title = "... Weather update ..."
content.subtitle = ""
content.body = "my alert text"
content.sound = nil
logSB.info("Tickle Weather alert sent at \(currentDate)")
let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 0.2, repeats: false)
let request = UNNotificationRequest(identifier:requestIdentifier, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request) { (error) in
if (error != nil){
self.logSB.error("ERROR sending a notification at \(currentDate)")
} // close error conditional
} // close userNotification
The user's logs show that web data were fetched and processed and that the alerts are sent with no error logged. But the user sees nothing.
What are we missing?
[update] I forgot to mention: When the user crosses a geofence set within my app, that notification comes through. Occaionally one of the previously missing alerts will fire at the same time, even a day late.