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

[ios] Custom Location provider and Annotation Images warping/disappearing when changing image too quickly #4185

Closed
LesSvant opened this issue Mar 3, 2016 · 3 comments
Labels
iOS Mapbox Maps SDK for iOS

Comments

@LesSvant
Copy link

LesSvant commented Mar 3, 2016

I am using mapbox 3.1.2 to draw indoor maps and we would like to be able to show the users location. Since that is not available from the phones native location provider we cannot use ".showsUserLocation = true".

Right now we solve this by using an annotation to show the users location, but this creates a few issues especially with trying to show direction the user is facing. When we update the annotation image too often the annotation image will warp, eventually disappear and then start showing [INFO] {Worker}[Sprite]: Can't find sprite named 'com.mapbox.sprites.userLocation'

Are there any plans to implement a way to set a custom location provider and/or a fix for annotation images when changing them?

img_0080
img_0081

@tobrun tobrun added the iOS Mapbox Maps SDK for iOS label Mar 3, 2016
@stm233
Copy link

stm233 commented Mar 14, 2016

i have same problem, do you solve it?

@LesSvant
Copy link
Author

Stm233, sorry no solution yet.

@1ec5
Copy link
Contributor

1ec5 commented May 13, 2016

I am using mapbox 3.1.2 to draw indoor maps and we would like to be able to show the users location. Since that is not available from the phones native location provider we cannot use ".showsUserLocation = true".

I’m afraid I don’t understand – is the issue that CLLocationManager doesn’t work indoors? If so, there may be a cleaner approach to controlling the built-in user location annotation. Extend or subclass MGLMapView to conform to CLLocationManagerDelegate:

// ViewController.m
@interface MGLMapView () <CLLocationManagerDelegate>
@end
// ViewController.swift
extension MGLMapView: CLLocationManagerDelegate {}

Then call -locationManager:didUpdateLocations:animated: and/or -locationManager:didUpdateHeading: on the MGLMapView instance. This approach is similar to how you’d mock user location for automated testing.

When we update the annotation image too often the annotation image will warp, eventually disappear and then start showing [INFO] {Worker}[Sprite]: Can't find sprite named 'com.mapbox.sprites.userLocation'

You’re removing the annotation and adding a new one every time the location changes, correct? As of #3835, which is in v3.3.0-alpha.2, you can simply change the coordinate property of any point annotation in a KVO-compliant way, and the annotation will move accordingly. That’ll probably avoid this issue.

The underlying rendering artifacting is probably the same issue being tracked in #3185. For this use case, you’ll eventually also be able to use a native UIView for the annotation (#4801), avoiding #3185 entirely.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

5 participants