I'm using NSURLSession's uploadTaskWithRequest:FromFile: to upload a file in the background. This works, however I'd like to upload only a certain part of the file. So I am trying to get the upload task to only upload a certain range of the file.
I've tried setting the Content-Range and Range headers, e.g.:
[request addValue:@"bytes 2367488-7056719/7056719" forHTTPHeaderField:@"Content-Range"];
[request addValue:@"4689232" forHTTPHeaderField:@"Content-Length"];
However this does not work - the upload session sends the entire file anyway. It preserves the Range header and overwrites the Content-Length header with the entire file's size.
Does anyone know if this can be done?
I've seen references to upload resume not being possible with background upload task, which is essentially the same thing (for instance this question). But no direct reference to sending a certain range.
My only solution thus far is to write a chopped version of the file to disk.. I'd like to avoid that.