My application was working fine on iOS6 but it is crashing on iOS 7 due to bad access when I add overlay to MKMapView.My code is as follows
MKPolyline *polyl
Use following If you are creating poly lines in thread other than main thread:
[self performSelectorOnMainThread:@selector(addPolyLineToMap:) withObject:polyline waitUntilDone:NO];
-(void)addPolyLineToMap:(MKPolyline*)apolyline{
[mapview addOverlay:apolyline];
}
I had the same problem, the stack trace looks misleading to me. My bugfix is to explicitely add the overlay on the main thread:
dispatch_async(dispatch_get_main_queue(), ^{
[mapView addOverlay:myRouteLine];
});
or if you'd like to use the new MKOverlayRenderer:
dispatch_async(dispatch_get_main_queue(), ^{
[mapView addOverlay:myRouteLine level:MKOverlayLevelAboveRoads];
});
In my case, I'm downloading asynchronously some data, generate Polylines, create MKOverlayViews / MKOverlayRenderes (didn't help to replace the deprecated code) and add the overlay to the map.