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

MGLMapView calls MGLMapViewDelegate 'viewForAnnotation:' for annotations outside visible area #6173

Closed
1uss1 opened this issue Aug 26, 2016 · 2 comments
Labels
annotations Annotations on iOS and macOS or markers on Android bug iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage

Comments

@1uss1
Copy link

1uss1 commented Aug 26, 2016

Platform: iOS
Mapbox SDK version: 3.3.4

Steps to trigger behavior

  1. Build & run Mapbox iOS example app located at 'platform/ios/ios.xcodeproj'
  2. Click 'gear' icon on top left corner to open Map Settings menu
  3. Click 'Add 100 Views' to add annotations to map
  4. Pan map so annotations are outside the visible map area.
  5. Keep panning into areas with no annotations

Expected behavior

No annotations are visible on the map or nowhere near the borders of visible area, MGLMapView should not(?) call method:
**'- (MGLAnnotationView )mapView:(MGLMapView )mapView viewForAnnotation:(id)annotation'

Why? Because there's no annotations visible.

Actual behavior

**'- (MGLAnnotationView )mapView:(MGLMapView )mapView viewForAnnotation:(id)annotation' is called constantly while panning on the map while there are no annotations nowhere near the visible area.

Below is the callstack.

screen shot 2016-08-26 at 16 59 07

In a nutshell 'MGLMapView notifyMapChange:' method is called with param MapChangeDidFinishRenderingFrameFullyRendered which triggers a update for all annotations(?)

Why is this a problem?

The map becomes very unresponsive with large amount of MGLAnnotationView objects placed on the map. I feel like the annotation view reuse queue is not working like it is intended to work.

@1uss1 1uss1 changed the title MGLMapViewDelegate calls viewForAnnotation: for annotations outside visible area MGLMapView calls MGLMapViewDelegate 'viewForAnnotation:' for annotations outside visible area Aug 26, 2016
@1ec5
Copy link
Contributor

1ec5 commented Aug 26, 2016

Related: #5787 (comment)

/cc @boundsj @incanus

@incanus incanus added bug iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage annotations Annotations on iOS and macOS or markers on Android labels Aug 26, 2016
@boundsj
Copy link
Contributor

boundsj commented Nov 1, 2016

This is fixed in #5987. #5987 will be in the next release (beta 2).

@boundsj boundsj closed this as completed Nov 1, 2016
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 bug iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

No branches or pull requests

4 participants