react-native-background-downloader
react-native-background-downloader copied to clipboard
ios error No such file or directory
Hi in ios when i fully close app from multi task manager and go back to app and run checkForExistingDownloads function i get error , on android with same code every thing is fine and file continued to download.
let lostTasks = await RNBackgroundDownloader.checkForExistingDownloads();
console.log(lostTasks);
for (let task of lostTasks) {
task.progress((percent: any) => {
console.log(`Downloaded: ${percent * 100}%`);
}).done(() => {
console.log('Downlaod is done!');
})
.error((error: any) => {
console.log('Download canceled due to error: ', error);
});
}
i get this error :
Download canceled due to error: The operation couldn’t be completed. No such file or directory
and returned task from "checkForExistingDownloads" is:
{
state: "FAILED"
percent: 0
bytesWritten: 0
totalBytes: 104857600
id: "life365"
}
Have you followed the required steps before opening a bug report?
- [x] I have reviewed the documentation in its entirety, including the dedicated documentations :books:.
- [x] I have searched for existing issues and made sure that the problem hasn't already been reported.
- [x] I am using the latest plugin version.
Environment
Environment: React: 16.9.0 React native: 0.61.4 react-native-background-downloader: 2.3.4
Steps to Reproduce
on ios 1.start download 2. close app from multi tasking 3.start app again and run checkForExistingDownloads
Thanks
I confirm I can reproduce the same behavior, did you find a solution?
@giuseppe4 not yet :(
@ptelad can you help me in to solve problem ?
It also happens to me. I'm able to make android downloads restart normally, but on iOS it displays an "file not found" error.
I believe this is expected behaviour - If the user terminates the app, background downloads are cancelled. See Apple docs
Old thread, but if you want to test what happens to the download after the app is closed, you can either terminate the app through the Xcode stop button, or add an additional button to the iOS code that calls exit(0);
The system will treat either of the above as a non-user initiated killing of the app and continue with the background download