-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[iOS] Offline download from background thread #14206
Comments
Would it be feasible for your application to interact with the singleton within a MGLOfflineStorage wasn’t designed to be initialized on a background thread, at least. I’m not sure how feasible it would be to make the class safe for background threads, given all the work it does on the file system with the cache database and, as you mention, its use by MGLMapView and potentially other UI classes. We should probably document that |
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
Hi, Sorry for the lake of reactivity, I didn't see your response to this issue. Note: If I remember properly, we can instantiate from the background thread, run a region download and it works fine. The crash occurs only when you try to display the map after that. Etienne |
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
It would be great if this can work on DispatchQueue.global().async {}. That is not possible right? |
I was working on an application that requires offline download. I have to perform an Api call before starting to download the map and the callback of this call is not running on the main thread.
I ran the download process from this background thread and the download works fine. But, when I instantiate the map, it crashes.
iOS Version 4.9.0 (tested on 4.7.0 and 4.8.0)
Steps to reproduce
Expected behavior
The map should be displayed
Actual behavior
The application crash
Opinions
I didn't find any information about the fact that MWZOfflineStorage.shared should be instantiated on the main thread. If I missed this information, sorry for this post.
As MWZOfflineStorage.shared is a Singleton, I suppose that when the first call is made in a background thread the MGLMapView fails to use it properly in the main thread.
Etienne
The text was updated successfully, but these errors were encountered: