问题
I'm using NSURLSession
to download a list of files in my app.I have support for background downloading and is working correctly.But some times when the WiFi connectivity is lost while the app is in background,some files remain in the temp directory(com.apple.nsnetworkd
) and is not getting removed.So when i download a new set of files these files still remains in the directory.This situation repeats on WiFi failures and the set of files keeps accumulating.Any way to solve this issue?
Will there be any problem if i try to remove these files manually?
If WiFi connection is active then everything works fine and tmp directory is cleared automatically.
回答1:
Trying resuming the task or don't worry if you still find it ios to handle it when required to free the space
From Doc A file URL where the temporary file can be found. Because the file is temporary, your delegate method must either open the file for reading or move it to a permanent location in your app’s sandbox container directory before returning.
来源:https://stackoverflow.com/questions/22857379/clearing-temp-download-files-after-network-failure-using-nsurlsession