summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r--platform/ios/src/MGLMapView.mm9
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 79467a065f..6f51d4b523 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -3777,7 +3777,14 @@ public:
UIView <MGLCalloutView> *calloutView;
if ([self.delegate respondsToSelector:@selector(mapView:calloutViewForAnnotation:)])
{
- calloutView = [self.delegate mapView:self calloutViewForAnnotation:annotation];
+ id providedCalloutView = [self.delegate mapView:self calloutViewForAnnotation:annotation];
+ if (providedCalloutView) {
+ if (![providedCalloutView isKindOfClass:[UIView class]]) {
+ [NSException raise:NSInvalidArgumentException format:@"Callout view must be a kind of UIView"];
+ }
+ NSAssert([providedCalloutView conformsToProtocol:@protocol(MGLCalloutView)], @"callout view must conform to MGLCalloutView");
+ calloutView = providedCalloutView;
+ }
}
if (!calloutView)
{