I've written a Watchkit Extension (WatchOS 5.1.1) where I'm attempting to fetch data every 30 minutes or so.
I've read so far that the background task scheduling is not punctual by the minute, but pretty reliable to use couple times an hour.
I'm scheduling the task using
WKExtension.shared().scheduleBackgroundRefresh(withPreferredDate: Date(timeIntervalSinceNow: interval * 60 ), userInfo: ["time": Logger.getDateString()] as NSDictionary ) { (error: Error?) in
if let error = error {
print("Error occured while scheduling background refresh: \(error.localizedDescription)")
}
}
This works, however no matter what Intervall I chose, the task is only executed after around 60 minutes. I've written myself a log where I can see when
func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>)
is called in the ExtensionDelegate, and I can confirm that the handle is just called not often enough.
My Watch is on >80% batterie so that doesn't seem to be the issue.
Appreciate any input on this!