flutter_downloader
flutter_downloader copied to clipboard
Flutter downloader not loading tasks in ios
After downloading the file the plugin does not load the the tasks .
FlutterDownloader.loadTasks() not loading downloaded tasks or its progress
List<DownloadTask>? getTasks = await FlutterDownloader.loadTasks();
it shows empty it works in android but not working in ios simulator
@noeljayson did it work on a previous version?
No it's not working in previous version
Hi,
Im with the same problem. On android everything is working fine
Hi,I have the same problem, in iOS
Is this issue solved in lastest update I don't have Mac to test
Need to dig deeper, but from what I can gather the sqlite3_open
is failing with the error "unable to open database file" returned from sqlite3_errmsg
.
https://github.com/fluttercommunity/flutter_downloader/blob/master/ios/Classes/DBManager.m#L101
“download_tasks.sql” couldn’t be moved to “Application Support” because either the former doesn’t exist, or the folder containing the latter doesn’t exist.
I think this is due to NSApplicationSupportDirectory
not existing initially and needs to be created:
[[NSFileManager defaultManager] createDirectoryAtPath:self.appDirectory withIntermediateDirectories:true attributes:nil error:&error];
https://stackoverflow.com/questions/16204988/ios-cant-save-file-to-application-support-folder-but-can-to-documents
Is this issue solved in lastest update I don't have Mac to test
@noeljayson yes, solved
Is this issue solved in lastest update I don't have Mac to test
@noeljayson yes, solved
No bro i have tested it yesterday it is not loading tasks it is showing empty
Hi, I've found the flutter_downloader to be comprehensive, but also a bit buggy, so I wrote a much simpler download package background_downloader. Have a look and see if it serves your needs.
Is this issue solved in lastest update I don't have Mac to test
@noeljayson yes, solved
No bro i have tested it yesterday it is not loading tasks it is showing empty
I found the solution, is a problem in the newer update, they added a variable allowCellular, when doing a FlutterDownloader.enqueue() you need to set it inside mandatory if you use loadTasksWithRawQuery, is probably a missing implementation as for loadTasks it is not needed. So just add allowCellular: true
and it will work.
Is this issue solved in lastest update I don't have Mac to test
@noeljayson yes, solved
No bro i have tested it yesterday it is not loading tasks it is showing empty
I found the solution, is a problem in the newer update, they added a variable allowCellular, when doing a FlutterDownloader.enqueue() you need to set it inside mandatory if you use loadTasksWithRawQuery, is probably a missing implementation as for loadTasks it is not needed. So just add
allowCellular: true
and it will work.
Didn't quite understand your solution, in the FlutterDownloader.enqueue() constructor, "enable cellular" is set to true by default.
I made a PR to solve the issue: #803 In the latest update they solved the problem for loadTasks but didn't made the implementation for loadTasksWithRawQuery, I solved by editing my local pub cache for now with the code in the PR.
@lucaantonelli I don't understand either. I call enqueue
and receive an ID, but there are no tasks coming back regardless if I call loadTasksWithRawQuery
or loadTasks
.
XCode has console messages saying that the db table couldn't be created/opened:
2023-01-27 14:41:14.409124-0500 Runner[91608:2755010] [logging-persist] cannot open file at line 46846 of [554764a6e7]
2023-01-27 14:41:14.409272-0500 Runner[91608:2755010] [logging-persist] os_unix.c:46847: (0) open(/Users/daveshirman/Library/Developer/CoreSimulator/Devices/87E9B360-9F79-4769-B51C-50A6D4C130D0/data/Containers/Data/Application/DF3B920F-C0D4-49F0-ABAB-A7C00DCC6D4E/Library/Application Support/download_tasks.sql) - Undefined error: 0
2023-01-27 14:41:15.019091-0500 Runner[91608:2755978] [logging-persist] cannot open file at line 46846 of [554764a6e7]
2023-01-27 14:41:15.019338-0
How did you solve this with version 1.10.1+2
?
@daveshirman Maybe i have confused something. I solved a problem where loadTasksWithRawQuery show an error when called if allowCellular was not set. About your problem of the tasks table not getting created, is something i have struggled with too in the last week, probably something related with the #728 and #757 where they moved the database from public folder to app folder. I will check if i find a solution, for now in my app i switched to open_filex plugin for opening file, i know this isn't a solution.
Same issue.
iOS DB is invalid absolutely on FlutterDownloader ^1.9.1. iOS can't open file download_tasks.sql, the file may never be created successfully.
Problem occurred with DB migration before?
any update on this? I can still see that loadTasks() returns [] sometimes, and sometimes it returns the value. Why is this disimilarities. I am on version:
flutter_downloader: ^1.11.5 by the time of pasting this issue.
You can see in my console i mostly get this: