here is the situation:
- my server only accept multipart/form-data upload action.
- my app need to implement background upload.
I've tried below:
if I ignore
background
, I can useuploadTaskWithRequest:fromData:
, build all boundary, content-disposition, and file data, then upload to a supported server. and I do successfully have done this.BUT
I need to use background transfer.if I force this method in background mode, I got an error:
Upload tasks from NSData are not supported in background sessions.
if I use background mode, and use
uploadTaskWithRequest:fromFile:
, I got something like 'stream ended unexpectedly
' from the server, as this question mentions, the best answer suggest people to usefromData
which apparently is not my need.
so is there any way to accomplish this? since the server can't change it's support, I NEED background transportation and multipart/form-data content-type both.