I developed a small application using MKMapView
where MKAnnotations
are added continuously on the map. It works well as long as the user does not touch the map view.
If the user tries to interact with the map, I noticed that no new MKAnnotationViews
are added to the map. In fact, I discovered that as long as the user keeps interacting with the map, mapView: didAddAnnotationViews:
is not called. As soon as the user's finger leaves the screen, mapView: didAddAnnotationViews:
is called, passing in argument all the MKAnnotationViews
that should have been added.
I tried forcing a call to mapView: didAddAnnotationViews
, but I need to pass the MKAnnotationViews
as arguments (so I can't used anything based on periodic calls), and when I try to call it at the end of mapView: viewForAnnotation:
, it doesn't work since the view as not yet been added to the mapView. It is also a bad idea to try and add the annotation via another thread, since this will result in a Collection was mutated while being enumerated
exception (probably coming from the mutable array storing the annotation views).
Is there any way to fix that ?