0

After following the Mapbox First Steps guide I haven't been able to figure out how to get a user's location to display in the app. Has anyone successfully gotten the user location marker to show up in iOS9 using the latest MapboxGL build? My assumption is the user location marker is similar to the marker in the non-GL Mapbox library (a pulsating marker).

Steps taken:

  1. Per the First Steps guide, Info.plist was updated with the NSLocationAlwaysUsageDescription property.
  2. Map is initialised with a call to mapView.showsUserLocation = true.
  3. I implemented the MGLMapViewDelegate didUpdateUserLocation function to simply log all method invocations. I found that the coordinates contain invalid values (the latitude and longitude values seem to both be: 3.40282346638529e+38).

Currently testing this on Xcode7 Beta 3 / Swift 2.0 / MapboxGL 0.5.2.

Mike Smith
  • 87
  • 9

2 Answers2

0

Sorry for the confusion, there's a bug in <=0.5.1 where Mapbox GL never asks for location permissions if the app wants always permission. This will be fixed in the next release, 0.6.0.

Mapbox GL will properly ask if NSLocationWhenInUseUsageDescription is set instead, so using WhenInUse permissions is the easiest workaround.

During development, it's also possible to manually authorize location in Settings.app → Privacy → Location Services → YourAppName.

Another workaround would be to request always permissions using your own CLLocationManager.

friedbunny
  • 2,421
  • 1
  • 23
  • 38
  • Thanks for the update. I added `NSLocationWhenInUseUsageDescription` to be sure and I see [this line of code](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/MGLMapView.mm#L2314) failing to set the new location. Looking at a newly reported issue on [Github](https://github.com/mapbox/mapbox-gl-native/issues/1912), it seems like this may an ios9-specific issue. – Mike Smith Jul 22 '15 at 15:05
0

fixed in latest mapbox-gl build. See this

Mike Smith
  • 87
  • 9