Networking with URLSession 路 Background Sessions | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/7476-networking-with-urlsession/lessons/15

Hi Brian, Can you help with something? If you pause and resume a download more than once, it frezees when you try to resume. I didn鈥檛 notice before because the downloads of halftunes are superfast in reason of the size of files. But i used the halftunes approach to my own project that download a podcast episodes and i having the trouble. Apparently after the second time you pause the download, the resume data produced can鈥檛 restart the download. Can you help me to solve this issue? Thanks!

@vbavinicius Thanks very much for your question!

My first question to you is, are you using Operations to pause, and resume? If so, my suggestion would be to check your code there, and see how you鈥檝e implemented those methods. The delegate methods for Operations allow you to pause and resume your tasks so my advice would be to check how you鈥檙e pausing and resuming your download task in these methods.

Fayyaz

There may have been a bug in the code of the app when I wrote this. I鈥檓 not sure. The best bet with your app is to start with the documentation and review. Next, you鈥檒l need to provide your code. You can post it here and look for help from the community, but a better place is stackoverflow (although the quality of the answers can be all over the map).

Hi Fayyaz,

The bug is happening in the final version available in chapter download. Is very difficult to reproduce once the half song files available in itunes are very small. When the download starts, if you pause and resume, the app works as expected. But if you try to pause and resume a second time, the download freezes.

As i said is difficult to reproduce, i was able to notice this trouble when i changed the download to a podcast episode.

Do you have any ideia how to fix this problem?

Thanks!