DEPRECATED-mapbox-ios-sdk
DEPRECATED-mapbox-ios-sdk copied to clipboard
Location dot moves with scrolling
I think this bug just came about after the last big update, but if you track location, then start scrolling (thus canceling tracking) the dot jumps to the edge of the screen, following the scroll. Scroll left and right quickly to see it.
@russellquinn, can you elaborate if you're still seeing this? I can't replicate.
Yep, still an issue for me: https://dl.dropbox.com/u/44154592/LocationDotProblem.mov
Ah, that helps. Thanks.
Can we reopen this one? I don't have permission.
Whoops.
Man, I just cannot replicate this, even in your app (latest beta). Sure you're not doing something odd in your testing? I can never get the dot to jump.
Happens in simulator, iPhone 4S and iPad (all on iOS 5.1.1) exactly like the movie I posted above. Very weird.
I've tried timing and not timing it with the known update intervals (about 1s) between "pulses" of the location manager. Also tried different device orientations.
There's absolutely no magic in the gestures required to replicate it, just tracking location then panning left and right like in the video shows it every time. It you can't see it in our app beta, it must be related to something else in our setups that differs. Hmm.
Also, can you replicate this in any of our test apps or just yours?
I just tried it in MapBox Me and no, it doesn't happen.
But, then I did some more investigation, and it seems related to annotations — if I don't add any annotations then it's fine.
I also tried adding annotations, but then returning nil in layerForAnnotation, and it still happens, so it's something about adding lots of annotations via addAnnotation. (We have a couple of hundred I guess.)
Note that it still happens even when browsing somewhere far away from any annotations (like, in a country without any) so I don't think it's directly related to the drawing of these annotations?
Here's another video showing it:
https://dl.dropbox.com/u/44154592/LocationDotProblem_2.mov
Cool, I will mock up a bunch of annotations on a loop and see what I can dig up.
I'm working with 200 annotations and can't replicate. Are you creating layers on callback or by assigning layer
upfront? Anything else odd about the way you are making annotations?
Here's where I add the markers to the map. If I don't do this, it's fine.
The same problem happens whether I later return something in layerForAnnotation or I just return nil.
UIImage *markerImage = [UIImage imageNamed:@"mapMarker.png"];
for (FieldReport *fieldReport in [fetchedResultsController fetchedObjects])
{
CLLocationCoordinate2D location = CLLocationCoordinate2DMake([fieldReport.latitude doubleValue], [fieldReport.longitude doubleValue]);
RMAnnotation *annonotion = [RMAnnotation annotationWithMapView:mapView coordinate:location andTitle:@""];
annonotion.annotationType = kRMFieldReportAnnotationTypeName;
annonotion.annotationIcon = markerImage;
annonotion.anchorPoint = CGPointMake(0.4f, 1.0f);
annonotion.userInfo = fieldReport;
[mapView addAnnotation:annonotion];
}
Weird. Only things that jump out at me are 1. you don't need to use annotationIcon
as it doesn't do anything, and 2. try without the anchor point adjustment? But neither should really matter.
It must just have something to do with adding annotations, as you say.
Well, I was storing the icon and anchor point in the annotation, then using that information in layerForAnnotation. But I tried removing it from the adding function, and still got the problem.
I wonder if you're playing around with it enough to recreate the bug? I get it if I tap locate-me, then do a pretty hard swipe to the left (so the map moves right) then drag back toward the location dot in really tiny steps.
Where is the position of the dot calculated? I could try tracing/breaking on that to see if I can find anything?
It's updated here: https://github.com/mapbox/mapbox-ios-sdk/blob/develop/MapView/Map/RMMapView.m#L2721
userLocation
is an instance of RMUserLocation
, which is an RMAnnotation
that updates it's own coordinate
based on a passed CLLocation
.
Also worth noting: when just dragging a small amount, the blue dot drags correctly with the map, but drag over a certain distance or tap-up and it snaps back to its previous location.
This actually gives me an idea… I change the user location-related annotations' coordinate
, but don't explicitly request an annotation redraw/correction loop.
Here's another video detailing when the "snap back" happens. Watch the indicated tap-down state for when it's triggered by dragging too far, or lifting the finger up: https://dl.dropbox.com/u/44154592/MoreDot.mov
And you aren't adjusting the coordinate
of the userLocation
annotation yourself? Be sure to filter on annotation.isUserLocationAnnotation = NO
.
Yep, I double-checked. I'm not manipulating any annotations.
I put in a fix here related to the idea above… explicitly updating annotation positions after adjusting user position. Curious if this helps at all. I think the effect you see might be related to the annotation never getting its geo-position updated properly, thus snapping back into place at a bad geo point.
Okay, I'll try. Though the effect does seem like it's snapping back to the same offset from the screen edge each time?
Just tried it, but no, it didn't work :(
Related to this -- are you simulating a trip in the simulator, i.e. a constantly-changing user location? It doesn't look like one of the template ones but I'm curious anyway. When the map is being dragged, location doesn't update, but when released, it will jump in place. Your video almost looks like that is happening.
Nope, but I've tried simulating a trip (bug is still there). This happens both in the simulator and on devices though.
I wonder if this has to do with the use of multiple simultaneous CLLocationManager
objects, which I am not doing.