Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Ignore non-conforming user location annotation views - #6163

Merged
friedbunny merged 2 commits into
masterfrom
fb-ignore-bad-user-dots
Aug 26, 2016
Merged

friedbunny merged 2 commits into
masterfrom
fb-ignore-bad-user-dots

Conversation

@friedbunny

Copy link
Copy Markdown
Contributor

Prior to v3.4.0, a developer could indiscriminately return any UIView-conforming object in mapView:viewForAnnotation: and everything would be fine. With custom user location annotation views, we now also pass in a MGLUserLocation annotation, which requires a view that conforms to MGLUserLocationAnnotationView.

This pull request ignores views that the developer nominated for the user location annotation view that are not actually a kind of MGLUserLocationAnnotationView. This changes the alpha.2 behavior of asserting when the inheritance was wrong. When we ignore a view, the default user dot is used in its stead.

I’ve also documented that mapView:viewForAnnotation: can be used to customize the user location annotation view, because this is a somewhat unexpected new behavior.

Fixes #6100.

/cc @1ec5 @frederoni

@friedbunny friedbunny added iOS Mapbox Maps SDK for iOS annotations Annotations on iOS and macOS or markers on Android release blocker Blocks the next final release labels Aug 25, 2016
@friedbunny friedbunny added this to the ios-v3.4.0 milestone Aug 25, 2016
@friedbunny friedbunny self-assigned this Aug 25, 2016
Comment thread platform/ios/src/MGLMapViewDelegate.h Outdated

The user location annotation view can also be customized via this method. When
`annotation` is `MGLUserLocation`, return an instance of a custom
`MGLUserLocationAnnotationView` subclass.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct! How about this, then:

 The user location annotation view can also be customized via this method. When
 `annotation` is `MGLUserLocation`, return an instance of
 `MGLUserLocationAnnotationView` (or a subclass thereof).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. To be pedantic:

s/is MGLUserLocation/is an instance of MGLUserLocation (or equal to the map view's userLocation property)/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screen shot 2016-08-26 at 11 50 43 am

@friedbunny
friedbunny force-pushed the fb-ignore-bad-user-dots branch 2 times, most recently from 8f75ffb to 590a798 Compare August 26, 2016 16:20
Comment thread platform/ios/src/MGLMapView.mm Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid spamming the console, this message should only occur once per map view or once per process (and it should say so).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this message should include the view’s actual class, to aid in debugging.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

af771e0 limits the warning to being shown once and adds the name of the incorrect view to the text.

@friedbunny
friedbunny force-pushed the fb-ignore-bad-user-dots branch from 11018e3 to 9fcf669 Compare August 26, 2016 21:27
- Add note to mapView:viewForAnnotation: delegate method.
- Edit docs in iosapp's implementation of that delegate method.
@friedbunny
friedbunny force-pushed the fb-ignore-bad-user-dots branch from 9fcf669 to 8dff7ab Compare August 26, 2016 21:49
@friedbunny friedbunny removed the release blocker Blocks the next final release label Aug 26, 2016
@friedbunny
friedbunny merged commit 8dff7ab into master Aug 26, 2016
@friedbunny
friedbunny deleted the fb-ignore-bad-user-dots branch August 26, 2016 21:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

annotations Annotations on iOS and macOS or markers on Android iOS Mapbox Maps SDK for iOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants