iOS User Location Services for MapBox SDK

May 14 2012 by Justin Miller

We just released a new beta version of the MapBox iOS SDK with support for user location services. Watch the quick video below for an overview, or read on for all the details.

User location - showing it on the map

We’ve added an annotation class, RMUserLocation, that can be enabled on an RMMapView with a simple toggling of the showsUserLocation property. Regardless of whether you want to track and orient the map to the user’s location and heading, that data is available in the RMUserLocation so that it can be used in other portions of your app as well. And just like MapKit, you can query whether the user’s position is currently shown on screen with the isUserLocationVisible property.

User tracking - keeping the map in line

Beyond just plotting the user’s location on the map, you can enable tracking modes in order to keep the map in line with their location and compass heading. Just tweak the userTrackingMode property or, if you want more fine-grained control over the user interface, use the setUserTrackingMode:animated: method. You can choose between RMUserTrackingModeNone (the default), RMUserTrackingModeFollow to keep the map center on the user’s location, or RMUserTrackingModeFollowWithHeading to also keep the map rotated in the direction the user is facing.

Delegate callbacks - staying informed

We’ve also implemented all of the map view delegate callbacks found in MapKit, whether you want to stay abreast of starts, stops, and potential errors when locating the user, changes to the user’s location and/or compass heading, or changes to the tracking mode in order to update your app’s user interface.

Sample app

We’ve built a sample app showcasing the SDK’s new user location services, as well as our worldwide street-level map MapBox Streets. It’s called MapBox Me and it’s fully open source on GitHub for you to download as a starting point.

Rapid development

This new addition of user location services in the MapBox iOS SDK brings us feature-for-feature on par with MapKit – and beyond. The new user location services come hot on the heels of our new, unrestricted mobile app offline caching policy and our screencast showing five minute integration of MapBox hosted maps into native iOS apps. Stay tuned as we continue to enhance our SDK and put more and more control into developers' hands.