watchOS background downloads only work while phone is charging

I've been working on a watchOS extension that uses background refreshes and background downloads to periodically update a complication. (Xcode 10.0/10.13.6, series zero 🙂 watch/watchOS 4.3.2, iPhoneX/12.0).


Everything works really well, but only while the paired iPhone is charging. When the phone is not charging, the server sees no http request and no WKURLSessionRefreshBackgroundTask is passed to handleBackgroundTasks:.


Can anyone think of an explanation for this? I'm at a loss.


p.s. I recently found this forum post about NSURLSession's Resume Rate Limiter https://forums.developer.apple.com/message/42352

It refers to iOS, but it's not hard to imagine how it might apply to watchOS. This post explains many of the strange phenomena seen when working with background downloads on watchOS and should immediately be promoted to full documentation and reproduced verbatim on every page of the NSURLSession and WatchKit docs, and also referenced from timeoutIntervalForResource (getting exponentially rate limited for network timeouts while the background refresh mechanism thinks you're ok is extremely surprising). I can't see however how the RRL could explain my above problem.


p.p.s I've been away a while - what happened to the content on the old https://devforums.apple.com ? Is it gone forever?

Replies

My iPhone was in Low Power Mode. Turning it off made background downloads start working while not charging.


Nasty. Yeah.

Glad to see you sorted out your

NSURLSession
issue.

p.p.s I've been away a while - what happened to the content on the old https://devforums.apple.com ?

It has been offline for a while now.

Is it gone forever?

Pretty much (there are business issues that make it hard to resurrect it as a whole). I kept a copy of everything I posted, so if you’re looking for that then let me know and I’ll try and track it down.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks - I'm not sure exactly what I was looking for, but my code has the odd comment containing now mysterious devforum URLs.

Probably outrageously obsolete stuff, like the C based audio session API, what audio interruptions used to do to AudioQueues and the abrupt disappearance of the AMR codec. I think the account I used to use got locked too for some strange reason which is a pity because I had a few devforum points. Anyway, it's nice to be back.