Search code examples
iosdownloadalamofire

Resume download after killing or putting on background the application


I have some issues when I want to resume a download operation. I am using Alamofire 4.4 and I made my tests on iOS 9 and 10. Here is my use cases:

1- A download operation is in progress, I cancel the request (resumeData is generated and saved) and then I put the application on background. After relaunching the application, I resume the download (using the resumeData) some times the download is being resumed and sometimes is being restarted. Is it a normal behaviour ? And are there any solution if not ?

2- A download operation is in progress, and i kill the application. Downloaded data seems to be lost and I can't resume the download. Is there any solution to get the resumeData and resume the download after restarting the application ?

Thank you.


Solution

  • Finally I have reimplemented the download module using URLSession. My application is more stable now.