Raise exception when MGLAnnotationView.annotation property is nil (#8339)
* [ios] MGLAnnotationView annotation property made writable * [ios] standarized exception name for annotations
This commit is contained in:
committed by
GitHub
parent
6c6e895b23
commit
ffce46cae6
@@ -239,7 +239,10 @@
|
||||
}
|
||||
else if (dragState == MGLAnnotationViewDragStateCanceling)
|
||||
{
|
||||
NSAssert(self.annotation, @"Annotation property should not be nil.");
|
||||
if (!self.annotation) {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"Annotation property should not be nil."];
|
||||
}
|
||||
self.panGestureRecognizer.enabled = NO;
|
||||
self.longPressRecognizer.enabled = NO;
|
||||
self.center = [self.mapView convertCoordinate:self.annotation.coordinate toPointToView:self.mapView];
|
||||
|
||||
@@ -1519,14 +1519,18 @@ public:
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Handle the case of an offset annotation view by converting the tap point to be the geo location
|
||||
// of the annotation itself that the view represents
|
||||
for (MGLAnnotationView *view in self.annotationContainerView.annotationViews)
|
||||
{
|
||||
if (view.centerOffset.dx != 0 || view.centerOffset.dy != 0) {
|
||||
if (CGRectContainsPoint(view.frame, tapPoint)) {
|
||||
NSAssert(view.annotation, @"Annotation's view annotation property should not be nil.");
|
||||
if (!view.annotation) {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"Annotation view's annotation property should not be nil."];
|
||||
}
|
||||
|
||||
CGPoint annotationPoint = [self convertCoordinate:view.annotation.coordinate toPointToView:self];
|
||||
tapPoint = annotationPoint;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user