Offline Regions Empty after Restart App, IOS only
GaelleJoubert opened this issue · 2 comments
Hello,
I am facing a (new?) issue about offline regions, but only in IOS.
tldr : The function getListOfRegions()
return a empty list at the start of the app, even if we previously downloaded some regions in another session. This bug is only in IOS !!
At the start of the application, I am calling : getListOfRegions()
function, to get all the previously downloaded Regions.
In Android, the Downloaded regions are saved even when the app is killed. For exemple, if I do the following actions :
1- Download the Region (A)
2- Wait for the download to be over
3- Kill the App
4- Open the App and call the function getListOfRegions()
On the 4th action, the function getListOfRegions()
return the Region (A) as expected.
Now, if I do the exact same thing on IOS : on the 4th action, the function getListOfRegions()
return an empty list !
I am pretty sure it used to work fine on IOS, but it's not anymore.
I tried to run the exemple App bpth on Android and IOS, but starting downloading a region makes the app crash (both IOS and Android ...). But still I have noticed something similar :
- When I reopen the app on Android : it show me the region I tried to download as "dowloaded" (It offers me the option to delete it)
- When I reopen the App on IOS : the region is not shown as "downloaded".
Has anyone encouter the same issue ?
I would be curious to know if someone mannage to use offline region in IOS in a way to still have them after killing the app.
[FIX]
I fixed my issue.
TLDR : I was calling getListOfRegions()
too soon.
More detailed explaination :
I am using Provoider to save the list of downloaded Regions. My "SavedMapProvider" is instanciated at the very Root of my App, before Maplibre is ever called. The function getListOfRegions()
is called at the init of the Provider. At that time, (only in IOS), it returns 0 at the start of the app.
I tried to call the function later :
In the InitState of the page were the offline map are displayed.
Even there, If I call the functiun straigh away, it still return an empty list, but if I add a delaly of 500ms, this time, it worked !!
The weird thing is that I do not face this issue with Android.
I am also pretty sure that the behavior changed, and it use to work in IOS as well.
Knowing the fix, the issue was not that bad, but I guess maybe it is worth adding a little note in the Read Me, to avoid other a loooong time of debegging. (It took me a little bit more than a day to figure it out).
What do you think @m0nac0 should I do a PR to edit the read me ?
Maybe better add a note to the doc comment of getListOfRegions() in the dart code, to avoid the Readme getting to cluttered, and also since others with the same problem will/should probably look there, what do you think?