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

onStyleLoadedCallback fires (n - 1) times the map has been loaded #373

Closed
JoelGG opened this issue Aug 6, 2020 · 10 comments
Closed

onStyleLoadedCallback fires (n - 1) times the map has been loaded #373

JoelGG opened this issue Aug 6, 2020 · 10 comments
Labels
bug Something isn't working ios stale

Comments

@JoelGG
Copy link

JoelGG commented Aug 6, 2020

I currently need to navigate to a page containing a MapboxMap, and as suggested in the documentation I'm using onStyleLoadedCallback to generate and add all annotations for the map. Unfortunately I have noticed that on first load onStyleLoadedCallback does not fire, and on every subsequent navigation to the map it fires n times for however many times I have navigated to it (after the first navigation to it)

@m0nac0
Copy link
Collaborator

m0nac0 commented Aug 7, 2020

@JoelGG Thank you for the report. On what platform (android/iOS/web) and with which flutter and plugin version does this happen?

@JoelGG
Copy link
Author

JoelGG commented Aug 11, 2020

@m0nac0 thank you for your reply. This is on iOS and with the latest version of flutter-mapbox-gl available on pub.

@m0nac0
Copy link
Collaborator

m0nac0 commented Aug 13, 2020

@JoelGG Thank you. Might be related to #347 and/or #226 (?)

@m0nac0 m0nac0 added bug Something isn't working ios labels Aug 13, 2020
@AAverin
Copy link
Contributor

AAverin commented Sep 5, 2020

The fact that callback fires more than once points to a memory leak.
#389
#370
#226

@m0nac0
Copy link
Collaborator

m0nac0 commented Sep 6, 2020

@AAverin I have very little iOS dev experience, do you happen to have tested #370 and know if it fixes these issues?

@AAverin
Copy link
Contributor

AAverin commented Sep 6, 2020

@m0nac0 I also have very little iOS experience.
From what I see in the PR, it users weakReference to avoid capturing and holding the reference inside. Not sure if it is the problem exactly.
At the moment my app is barely usable on iOS due to map issues. I will try to take a look once I have time, but would be best if someone who has more iOS experience could check.
If the iOS SDK is working fine, then the issue should lie in the integration layer somewhere.

@AAverin
Copy link
Contributor

AAverin commented Sep 11, 2020

@m0nac0 could this be related? Was closed recently and probably is not yet updated in Flutter version: mapbox/mapbox-gl-native-ios#172
I will test on real device today

@AAverin
Copy link
Contributor

AAverin commented Sep 4, 2021

This seems to still be an issue on a real device.
onStyleLoadedCallback is not called reliably on iOS

@stale
Copy link

stale bot commented Jan 14, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 14, 2022
@AAverin
Copy link
Contributor

AAverin commented Jan 14, 2022

Hopefully all style loading issues were resolved in latest PRs

@AAverin AAverin closed this as completed Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios stale
Projects
None yet
Development

No branches or pull requests

3 participants