Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter downloader not loading tasks in ios #787

Open
noeljayson opened this issue Jan 5, 2023 · 17 comments
Open

Flutter downloader not loading tasks in ios #787

noeljayson opened this issue Jan 5, 2023 · 17 comments
Labels
bug Something isn't working

Comments

@noeljayson
Copy link

noeljayson commented Jan 5, 2023

After downloading the file the plugin does not load the the tasks .

FlutterDownloader.loadTasks() not loading downloaded tasks or its progress

List? getTasks = await FlutterDownloader.loadTasks();

it shows empty it works in android but not working in ios simulator

@noeljayson noeljayson added the bug Something isn't working label Jan 5, 2023
@markst
Copy link
Contributor

markst commented Jan 6, 2023

@noeljayson did it work on a previous version?

@noeljayson
Copy link
Author

No it's not working in previous version

@brunoda6
Copy link

brunoda6 commented Jan 6, 2023

Hi,
3
2
1

Im with the same problem.
On android everything is working fine

@Memet18
Copy link

Memet18 commented Jan 9, 2023

Hi,I have the same problem, in iOS

@noeljayson
Copy link
Author

Is this issue solved in lastest update
I don't have Mac to test

@markst
Copy link
Contributor

markst commented Jan 13, 2023

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

@markst
Copy link
Contributor

markst commented Jan 13, 2023

“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

@Memet18
Copy link

Memet18 commented Jan 13, 2023

Is this issue solved in lastest update
I don't have Mac to test

@noeljayson yes, solved

@noeljayson
Copy link
Author

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

@781flyingdutchman
Copy link
Contributor

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.

@lucaantonelli
Copy link
Contributor

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.

@Memet18
Copy link

Memet18 commented Jan 27, 2023

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.

@lucaantonelli
Copy link
Contributor

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.

@daveshirman
Copy link

daveshirman commented Jan 27, 2023

@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?

@lucaantonelli
Copy link
Contributor

lucaantonelli commented Jan 30, 2023

@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.

@jackleemeta
Copy link
Contributor

jackleemeta commented Feb 10, 2023

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?

@meshivanshsinghh
Copy link

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.
image

You can see in my console i mostly get this:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants