Hi everyone,
I'm developing a visionOS app that allows users to download large video files (similar to a movie download experience, with each file being around 10 GB). I've successfully implemented the core video download functionality using URLSession, and everything works as expected while the app is active.
Now, I’m looking to support background downloading. Specifically, I want users to be able to start a download and then leave the app (e.g., switch apps or return to the home screen) while the download continues in the background.
Additionally, I’d like to confirm a specific scenario: If the user starts a download, then removes the headset (keeping the device turned on and connected to power), will the download continue in the background? Or does visionOS suspend the app or downloads in this case?
I’m considering using a background URLSessionConfiguration (as done in iOS/macOS) to enable this behavior, but I’m not sure if it behaves the same way on visionOS or if there are special limitations or best practices when handling large downloads on this platform.
Any insights or official guidance would be greatly appreciated!
Thanks!
I’m considering using a background URLSessionConfiguration
Yep, do that.
I’m not aware of any specific limitations with this on visionOS. My experience is that, when it comes to networking, visionOS tends to behave very much like an iPad, so that’s the sort of behaviour I’d expect to see here.
However, background downloads are a case where it’s important that you do real world testing. The system has complex infrastructure for deciding when to run a background download. That infrastructure accepts a whole bunch of inputs, and the results can change between platforms, OS versions, and even on specific devices.
My Testing Background Session Code post has some hints and how to test this stuff. It’s focused on iOS, but the key points apply to all our platforms.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"