Download in the Background | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/10376245-networking-with-urlsession/lessons/20
1 Like

Hi, it would be awesome if you could include a video about the video UPLOADING in the background. Specially if it is possible to do things like “resume upload” when using the app or “monitor upload progress” when coming back to the app to check how it goes.

That’s an interesting suggestion and something I’ll take a look at. The upload task is very similar to the download task. I’d need to play around with it to see.

I already gave it a try with no success, it is a tricky one. It would be great to have this assets. Thank you!

Hi Brian
Thank you for the tutorial. I have a question here.
I noticed that the completionHandler received in handleEventsForBackgroundURLSession is always nil in both the cases when the app has been terminated and the download continues in the background and also when the app is in background and the download continues. So why are we using the method urlSessionDidFinishEvents in SongDownload class because the completionHandler is nil anyway. I tried without this method and noticed that the download and the change in UI state both work fine without it. Please suggest.

Hi @bdmoakley Thank you for the tutorial :blush: I have a question regarding NSURLSession with a background configuration. I my case I have a simple REST API to fetch a simple json response (around 15kb). This is done with a NSURLSession with a default configuration and a corresponding NSURLSessionDataTask at various times when the app is in the foreground. Now I need to do the same call upon receiving a silent push notification. As the app my be in the background, how would I need to configure the session? I mean it is not a lot of data that is being fetched, but the app may be in the background. Would I need to do this with an NSURLSession with a background configuration and a download task (as dataTasks are not supported with a background configuration) or default configuration? Thanks in Advance :slight_smile:

@reni99 Do you still have issues with this?

@shrutisharma Does this happen in the sample project too?

What about upload in the background?