mapbox-maps-flutter
mapbox-maps-flutter copied to clipboard
No manager found with ID across different AnnotationManagers on iOS
Recently we found these logs in Sentry:
PlatformException: PlatformException(0, No manager found with id: 2AD7C, null, null)
File "polyline_annotation_messager.dart", line 313, in _PolylineAnnotationMessager.create
File "<asynchronous suspension>"
the id obviously varying between entries
The calls we recorded these errors on are _PolylineAnnotationManager.create
, _PointAnnotationManager.create
and _PointAnnotationManager.createMulti
.
I have been digging like a maniac but I could not find out why these errors would exist in the first place; we are not calling map.annotations.removeAnnotationManager
anywhere in our code, so by my understanding, there shouldn't be a reason a manager should ever be removed from the dict here in the first place:
https://github.com/mapbox/mapbox-maps-flutter/blob/338a45121472e7ad83a7b2ac173b18a1d900ac05/ios/Classes/AnnotationController.swift#L33-L35
I also noticed that the error message does not seem to differ between "not finding the manager" and "something else going wrong" here:
https://github.com/mapbox/mapbox-maps-flutter/blob/338a45121472e7ad83a7b2ac173b18a1d900ac05/ios/Classes/PointAnnotationController.swift#L14-L26
I am unfortunately in a bit of a pickle since I cannot myself reproduce the error locally; otherwise I would have done more digging myself. I have also messaged the user if he can reproduce this reliably; if so, I am going to send him a version with an attempt at better error tracing embedded so I can hopefully provide more information then.
He could reproduce this reliably and having updated some of the error logging to this:
https://github.com/mapbox/mapbox-maps-flutter/blob/bae33337fd96882d897c242f9583e418ebb93893/ios/Classes/PointAnnotationController.swift#L42-L44
it turns out that indeed, the ControllerDelegate appears to lose track of the annotationmanager; the full error now is:
PlatformException(0, No manager found with id: FAD82, caught error: mapbox_maps_flutter.AnnotationControllerError.noManagerFound, description: The operation couldn’t be completed. (mapbox_maps_flutter.AnnotationControllerError error 0.), null, null)
Any leads on how to fix this are much appreciated!
Our current workaround is to remove all annotation managers and recreate them (to maintain their order, see #37) whenever we call any create / createMulti which seems quite excessive. We could reproduce the error on an iPhone 7 with iOS 14 at long last but unfortunately lack the resources to further debug this issue atm.
The problem seems to still be happening with the current version, we are also experiencing the same issue. The workaround is kinda icky, since it causes a short flicker of the polyline everytime it is updated.
any update ..?