TWRDownloadManager
TWRDownloadManager copied to clipboard
2 Progress Values
I'm not sure if this is a bug or not.
If I start a download, then kill my app (using the stop button in xCode), then resume my app and start the download again, the progress block seems to be fired twice with different values.
Any idea why it does that?
I did some testing and discovered that I have multiple tasks piling up in the background session manager.
This post helped me find the issue. http://stackoverflow.com/questions/23492311/nsurlsession-background-task-avoid-duplicates
Here's where I'm lost. If I start a download request, and the app is killed or suspended. Doesn't TWRDownloadManager lose track of the download objects in the download array?
How does it know where to copy the files when it's done downloading?
I'm experiencing the same issue.
I am surprised to see that this is an issue. The whole reason why I chose this library was because of its ability to perform background tasks. If that doesn't work, then Houston we have a problem.
@Hackmodford, did you check in your code that a download was not in progress and that the file didn't exist before requesting the download?
This only happens when you kill the app with Xcode or if the app somehow crashes, the reason behind this is that background tasks are not killed by Xcode when you stop execution, the background task stays running with the same identifier, thus when you open the app again the handler will fire twice due to the recent "lost" download, and the actual download you're starting.
I see. I was under the impression that the whole purpose of URL session was precisely to be able to handle this kind of situation amongst others.
I will check if it's not due to the way it was implemented in TWRDownloadManager.
On Mon, Apr 24, 2017 at 8:57 AM, Sami Sharaf [email protected] wrote:
This only happens when you kill the app with Xcode or if the app somehow crashes, the reason behind this is that background tasks are not killed by Xcode when you stop execution, the background task stays running with the same identifier, thus when you open the app again the handler will fire twice due to the recent "lost" download, and the actual download you're starting.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chasseurmic/TWRDownloadManager/issues/24#issuecomment-296658442, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbz-lnCVYDATWI9448YMc3187MnUKWrks5rzJw6gaJpZM4G01pn .
I'm 100% confident that this is caused by NSURLSessionDownloadTask itself since i already tried writing my own library using NSURLSession and ended up with the same exact results.
Ok. I will ready about it and see what's being missed.
On Mon, Apr 24, 2017 at 2:51 PM, Sami Sharaf [email protected] wrote:
I'm 100% confident that this is caused by NSURLSessionDownloadTask itself since i already tried writing my own library using NSURLSession and ended up with the same exact results.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chasseurmic/TWRDownloadManager/issues/24#issuecomment-296788094, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbz-m0RAOKzzKqiNhwQA8kTzt2JY0s9ks5rzO8ggaJpZM4G01pn .