0

I have a large video to upload like 3GB 4GB in size. And I need to use NSURLSessionUploadTask to upload it in background. If I try uploading this single file then it uploads fine but pause/resume in this case not works properly. I pause somewhere and it resumes from somewhere else or even from start.

So to achieve pause/resume, I move to chunks uploading. Now I create like 3 chunks at start, write their bytes in separate files and start uploading them. It works fine. Issue comes when app goes to background and existing chunks are uploaded completely. Now I need to add new chunks for uploading.

It gives me enough time to write files for other 3 chunks and start them, but those chunks never continue uploading unless user opens the app. Once app comes to foreground then those chunks start uploading. But same repeats when app goes to background and I need to add more chunks to it.

So chunks added to NSURLSession while app is in background never start uploading. Please provide help about it.

nmhmd
  • 11
  • 4
  • Are you using background configuration for NSURLSessionConfiguration. – Sandeep Jun 01 '15 at 17:59
  • @k6sandeep yes I am using background session – nmhmd Jun 07 '15 at 13:08
  • @nmhmd: Any solution you found for the chunk upload in background? – Raghav Feb 12 '16 at 10:45
  • yeah, the chunks are uploading. Chunks added to NSURLSession while app in background don't start uploading immediately. OS schedules them based on certain variables e.g. on wifi or mobile data, on charging etc. They start uploading but takes quite the time.. – nmhmd Feb 14 '16 at 14:24
  • That means that the chunk upload still holds good even if the app is running in the background for longer duration. – Raghav Feb 17 '16 at 06:23

0 Answers0