Merge pull request #2040 from mapbox/annotation-title-check

fixes #1951: check for support of title before querying
This commit is contained in:
Justin R. Miller
2015-08-11 15:21:39 -07:00

View File

@@ -2047,7 +2047,9 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
self.selectedAnnotation = annotation;
if (annotation.title && [self.delegate respondsToSelector:@selector(mapView:annotationCanShowCallout:)] &&
if ([annotation respondsToSelector:@selector(title)] &&
annotation.title &&
[self.delegate respondsToSelector:@selector(mapView:annotationCanShowCallout:)] &&
[self.delegate mapView:self annotationCanShowCallout:annotation])
{
// build the callout