From 018f39544276d469b24f98e2709b43ad75d7536f Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Thu, 25 Aug 2016 17:14:46 -0400 Subject: [PATCH] [ios] Ignore non-conforming user location annotation views --- platform/ios/src/MGLMapView.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index c3091a588..f43029d0b 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -3824,10 +3824,14 @@ public: if ([self.delegate respondsToSelector:@selector(mapView:viewForAnnotation:)]) { userLocationAnnotationView = (MGLUserLocationAnnotationView *)[self.delegate mapView:self viewForAnnotation:self.userLocation]; - if (userLocationAnnotationView) + if (userLocationAnnotationView && ! [userLocationAnnotationView isKindOfClass:MGLUserLocationAnnotationView.class]) { - NSAssert([userLocationAnnotationView.class isSubclassOfClass:MGLUserLocationAnnotationView.class], - @"User location annotation view must be a subclass of MGLUserLocationAnnotationView"); + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSLog(@"Ignoring user location annotation view with type %@. User location annotation view must be a kind of MGLUserLocationAnnotationView. This warning is only shown once and will become an error in a future version.", NSStringFromClass(userLocationAnnotationView.class)); + }); + + userLocationAnnotationView = nil; } }