Can I perform background upload using Cellular data?

I'm working on a background upload using NSUrlSessionUploadTask.


What happens is we create one upload task to upload the initial data, server returns an Id we can associate further uploads with.

So we create more tasks as the response comes back.

And then I came across this piece of information.


"If the background transfer is initiated while the app is in the background, the configuration object’s

discretionary
property is treated as being
true
."


Does this mean the second set of tasks we create will not be able to upload unless the phone is connected to wifi?

Or is that even considered to be in "Background" since technically the app was woken up and relaunched through the handleEventsForBackgroundURLSession delegate?


But if it does, how could we allow cellular uploads in background?



Unfortunately my company haven't given us SIM cards to test this out, so I have to rely on your wisdom.



Thank you very much.

Accepted Reply

In general you should not expect upload tasks created in a background session while your app is in the background to run over WWAN. It’s possible that they might, but the system is more likely to defer them until Wi-Fi is available.

The exact mechanics of this has changed over time. We discussed some of these changes in WWDC 2014 Session 707 What’s New in Foundation Networking. I’m not sure if things have changed substantially since then.

Share and Enjoy

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

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

Replies

In general you should not expect upload tasks created in a background session while your app is in the background to run over WWAN. It’s possible that they might, but the system is more likely to defer them until Wi-Fi is available.

The exact mechanics of this has changed over time. We discussed some of these changes in WWDC 2014 Session 707 What’s New in Foundation Networking. I’m not sure if things have changed substantially since then.

Share and Enjoy

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

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