Open andrealufino opened 7 years ago
I'd like to be able to let the user exit the app during the downloads Did you mean force quit the app? Or did you mean when app is in background?
App in background, not force quit
If it is working in simulator then it should also work in real device. I am not sure whats going on.
Make sure that background modes are enabled in Settings
in your device.
Everything is set on device. Basically my code add a download task every time a new one is finished, so I don't load all my 500 tasks once, but one per time. I don't know if this information can help you.
how to see the files in custom directory in my iphone.
hi is there a way to resume downloads after force quitting the app and opening it again
When user force quits app and relaunch the app this delegate method got called func URLSession(_ session: Foundation.URLSession, task: URLSessionTask, didCompleteWithError error: NSError?)
and in error's info there is a key i.e NSURLErrorBackgroundTaskCancelledReasonKey
and in this case its value will be NSURLErrorCancelledReasonUserForceQuitApplication
. There are additional keys in that user info try to find out the resume data from the error and restart the task with the resume data.
ok thank you very much for wonderful library 👍
+1 I have issue with background download (unknown error).
I am running app from xcode in my device, background is working. I will open second app and go back again to main app, download work.
I launch app from icon (after installed) and make the same steps as above, error trigger.
Any idea?
Hi, I'm trying to implement a way to resume a download task after the app has been quit by the user because I need to download a large file (300MB more or less).
can you share a code snippet that shows how to do that?
Hello. I'm using MZDownloadManager to perform around 500 downloads in my app. I'd like to be able to let the user exit the app during the downloads, but I'm not sure how to do it. I'm able to make this work on the Simulator without any specific setting, but not on the real device. I've set up the Background Modes capabilities for my target. Do you have any suggestion?