Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line annotations don't appear immediately on iOS #2380

Closed
JesseCrocker opened this issue May 10, 2024 · 9 comments · Fixed by #2395
Closed

Line annotations don't appear immediately on iOS #2380

JesseCrocker opened this issue May 10, 2024 · 9 comments · Fixed by #2395
Assignees
Labels
bug Something isn't working iOS

Comments

@JesseCrocker
Copy link
Collaborator

Describe the bug
When a line annotation(MLNPolyline) is added to the map, it should appear immediately. Instead it generally takes around 5 seconds to appear, but moving the map seems to make it appear immediately. In my application it happens every time on the simulator. I had thought it was simulator only, but now im seeing reports from users on old phones(iPhone 11) that they are seeing it on device.

This issue was introduced in 6.3.0, presumably in #2148

To Reproduce
Steps to reproduce the behavior:

  1. Create an annotation MLNPolyline(coordinate:[...], count:2)
  2. add to map mapView.addAnnotation(annotation)

Expected behavior
annotation appears immediately

Platform information (please complete the following information):

  • OS: ios 17
  • Platform iOS
  • Version 6.3.0 - 6.4.1

Additional context

I have tried to come up with a test case for this, but my test case works fine.

@JesseCrocker JesseCrocker added the bug Something isn't working label May 10, 2024
@sjg-wdw
Copy link
Collaborator

sjg-wdw commented May 10, 2024

You'd looked at line annotations at one point Stefan, I think. Can you take a quick look at this one when you get a chance?

@michaelkirk
Copy link

michaelkirk commented May 10, 2024

Here's an example video showing the behavior within the context of my app:

polyflicker.mov.mp4

I'll try to come up with a minimal example soon.

When you switch modes, the routes aren't drawn until either:

  1. ~5 sec delay
  2. immediately upon panning the map

Because my app logic zooms the map to fit the new polylines, it was actually a bit hard to notice at first - the behavior could only manifest if the new route line had the same bbox as the old. e.g. after the final click in the video (~14s) the map pans slightly, so the routes appear immediately (as expected).

@michaelkirk
Copy link

michaelkirk commented May 10, 2024

In my application I've been able to reproduce this with 6.4.1, and as far back as 6.0.0.

Going back further than that is inconvenient, because everything was renamed (Mapbox -> Maplibre). Patching up the names in my app is doable, but then I get a segfault, so I can't verify if this behavior existed before 6.0.0.

This issue was introduced in 6.3.0, presumably in #2148

@JesseCrocker - It's also broken for me in 6.2.0. Can you confirm the last good version for you?

If you're sure that your behavior worked prior to 6.3.0, then it seems we're experiencing different things.

I haven't ruled out that I'm doing something dumb. 😅

@louwers louwers added the iOS label May 10, 2024
@voncannon
Copy link
Contributor

voncannon commented May 11, 2024

I upgraded my app from v5.13.0 to the latest v6.4.1 and at first glance everything seems to be working and refreshing instantly.

I tested both MLNPolyline and MLNAnnotation.

I wonder what I'm missing or why my app is working? 🤔

By the way, holy moly the simulator feels so much faster now with metal rather than OpenGL. 🚀
I guess I need to look into upgrading.

  • Let me make a video.
Testing Notes

1. Upgraded to v6.4.1; bulk updated import Mapbox to import MapLibre; bulk renamed MGL* to MLN*
2. Xcode cleaned build
3. Wiped simulator, killed simulator
4. Killed Xcode. Restart.
5. Built app

@voncannon
Copy link
Contributor

voncannon commented May 11, 2024

Testing Notes:

  • Xcode Version 15.3
  • iOS Simulator iPhone 12 mini iOS 17.4
  • Did not test on an actual device yet

Test 1 - MLNPolyline

  • Dynamically updating a MLNPolyline when recording a track.
  • Uses mapView.addAnnotation to initially add MLNPolyline to map
  • Then subsequently uses MLNMultiPoint.appendCoordinates to append to the track
MLNPolyline_Test1.mov

Test 2 - Dynamically adding sources/layers to the map style

  • Using and combination of: MLNPolylineFeature, MLNShapeSource, MLNLineStyleLayer, MLNPointFeature, and MLNSymbolStyleLayer
MLNPolyline_Test2.mov

Test 3 - Adding Removing MLNAnnotation

  • Uses mapView.addAnnotation and mapView.removeAnnotation
test3_smaller.mov

@voncannon
Copy link
Contributor

I have the latest v6.4.1 running on my actual production device now as well and I'll do some testing there too

@louwers
Copy link
Collaborator

louwers commented May 11, 2024

Not 5 seconds for me but definitely not as snappy as expected.

Edit: Actually, the delay is in the triggering of the UITapGestureRecognizer because a tap could be a double tap to zoom.

Edit 2: So, it's instant for me...

Screen.Recording.2024-05-12.at.16.34.31.mov

@voncannon
Copy link
Contributor

Testing Notes:

  • MapLibre Native v6.4.1
  • iPhone 12 mini
  • iOS 17.4.1

A few things I noticed on an actual device:

  • The initial map load time seems worse to me than what I've seen on v5.13.0. Not sure if this is due to MapLibre or some issue in my app.
  • Once the map was loaded I did not notice delays/lags/issues with MLNPolylines or MLNAnnotations

I'm still confused as to why I'm not seeing these issues on v6.4.1 that you all are. 🤔

@alexcristici
Copy link
Collaborator

I've tested it, it's the same issue as #2337. I confirm it's not related to #2148.
I have a fix for it, PR is ready for review #2395.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants