Can NSUrlSessionUploadTask be used in a background session configuration?

Using

NSUrlSession
with a background configuration let's me download files even if the app gets terminated by iOS. Being curious, I tried to add an upload task and noticed that it won't continue, even not if the app is only suspended.

Apple talks about "Downloading in the background" but they don't explicitly state that uploading would not be possible.

Can somebody confirm that uploads and background session configuration don't work together?


My test showed that everything is fine on the Simulator - but ioS8 Simulator does not suspend any threads if an app gets backgrounded. So I ran this on my iPhone6. Downloads continue, when using an upload task, it gets interrupted.

Can somebody confirm that uploads and background session configuration don't work together?

Yes, or no, depending on how you expect folks to answer a negative question (-:

It is possible to upload in the background by creating an NSURLSessionUploadTask in an NSURLSession background session. I've written code to do that myself and, while there are some gotchas, as their are with any NSURLSession background session code, the basic functionality works just fine.

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"
Can NSUrlSessionUploadTask be used in a background session configuration?
 
 
Q