I have a MKMapView and another class has a thread adding annotations to the MKMapView.
But the problem is, MKMapView.annotations is nonatomic. So while the other class is adding annotations.... It looks OK if user do not move the map's visible area. But if you keep moving it, and the other class was adding annotations to the map at that moment, app crashes. Because the array was mutated during map was animating.
I made NSOperationQueue, and add each adding annotation job to the queue.
And then whenever map's region is changed, pause the NSOperationQueue.. and then restart it when region change is done.
I could get rid of most crashes.. but still it is happened occasionally.
Any idea?