I'm building an iOS app that monitors Kubernetes clusters and sends an alert when something breaks. There's no backend. The phone connects to the clusters directly with the user's own credentials, so I have nothing that could send a push, and every check has to run on the device.
I assumed background refresh would cover that. It didn't, and most of this post is about what I ended up using instead.
Background refresh
BGAppRefreshTask lets you ask for time and iOS decides if and when you get it. For an app people only open now and then, that can mean never. Apple DTS says there are "common scenarios where it won't grant you any ". Force-quit the app or turn on Low Power Mode and it doesn't run at all.
My TestFlight users were seeing widgets that said "Checked 1 day ago". Nothing was broken, the task just wasn't being scheduled. I still register it, but I stopped relying on it.
Streaming connections
The app keeps lists up to date with long-lived watch connections.…