4

I am trying to upload a huge video file using NSURLSession background upload task. I break the file into chunks of 256Kb and upload them. When the app is in foreground the upload of chunks happen real quick (5 seconds for 256Kb). But when the app is pushed to background though the upload continue to happen the speed of it is reduced crazily (5 minutes for 256Kb). Any thing wrong here or any thing I need to take care of ?

user2643583
  • 101
  • 1
  • 1
  • 4

1 Answers1

6

When your app is in the background, the user has indicated that whatever it's doing is not as important as something else. The system will throttle the background network tasks because they are not as important.

There is also the discretionary property on the configuration object which will, among other things, prefer to download when connected to power and wi-fi. If the download is initiated while the app is in the background, the download will behave as if the discretionary flag were true.

Jody Hagins
  • 27,943
  • 6
  • 58
  • 87