Authored by Justin R. Miller

fixes #481: update CL tracking API for iOS 8+

@@ -497,7 +497,9 @@ typedef enum : NSUInteger { @@ -497,7 +497,9 @@ typedef enum : NSUInteger {
497 * 497 *
498 * This property does not indicate whether the user’s position is actually visible on the map, only whether the map view is allowed to display it. To determine whether the user’s position is visible, use the userLocationVisible property. The default value of this property is `NO`. 498 * This property does not indicate whether the user’s position is actually visible on the map, only whether the map view is allowed to display it. To determine whether the user’s position is visible, use the userLocationVisible property. The default value of this property is `NO`.
499 * 499 *
500 -* Setting this property to `YES` causes the map view to use the Core Location framework to find the current location. As long as this property is `YES`, the map view continues to track the user’s location and update it periodically. */ 500 +* Setting this property to `YES` causes the map view to use the Core Location framework to find the current location. As long as this property is `YES`, the map view continues to track the user’s location and update it periodically.
  501 +*
  502 +* On iOS 8 and above, your app must specify a value for `NSLocationWhenInUseUsageDescription` in its `Info.plist` to satisfy the requirements of the underlying Core Location framework when enabling this property. */
501 @property (nonatomic, assign) BOOL showsUserLocation; 503 @property (nonatomic, assign) BOOL showsUserLocation;
502 504
503 /** The annotation object representing the user’s current location. (read-only) */ 505 /** The annotation object representing the user’s current location. (read-only) */
@@ -520,6 +522,8 @@ typedef enum : NSUInteger { @@ -520,6 +522,8 @@ typedef enum : NSUInteger {
520 * 522 *
521 * Setting the tracking mode to `RMUserTrackingModeFollow` or `RMUserTrackingModeFollowWithHeading` causes the map view to center the map on that location and begin tracking the user’s location. If the map is zoomed out, the map view automatically zooms in on the user’s location, effectively changing the current visible region. 523 * Setting the tracking mode to `RMUserTrackingModeFollow` or `RMUserTrackingModeFollowWithHeading` causes the map view to center the map on that location and begin tracking the user’s location. If the map is zoomed out, the map view automatically zooms in on the user’s location, effectively changing the current visible region.
522 * 524 *
  525 +* On iOS 8 and above, your app must specify a value for `NSLocationWhenInUseUsageDescription` in its `Info.plist` to satisfy the requirements of the underlying Core Location framework when tracking the user location.
  526 +*
523 * @param mode The mode used to track the user location. 527 * @param mode The mode used to track the user location.
524 * @param animated Whether changes to the map center or rotation should be animated when the mode is changed. */ 528 * @param animated Whether changes to the map center or rotation should be animated when the mode is changed. */
525 - (void)setUserTrackingMode:(RMUserTrackingMode)mode animated:(BOOL)animated; 529 - (void)setUserTrackingMode:(RMUserTrackingMode)mode animated:(BOOL)animated;
@@ -3223,6 +3223,15 @@ @@ -3223,6 +3223,15 @@
3223 self.userLocation = [RMUserLocation annotationWithMapView:self coordinate:CLLocationCoordinate2DMake(MAXFLOAT, MAXFLOAT) andTitle:nil]; 3223 self.userLocation = [RMUserLocation annotationWithMapView:self coordinate:CLLocationCoordinate2DMake(MAXFLOAT, MAXFLOAT) andTitle:nil];
3224 3224
3225 _locationManager = [CLLocationManager new]; 3225 _locationManager = [CLLocationManager new];
  3226 +
  3227 + // enable iOS 8+ location authorization API
  3228 + //
  3229 + if ([CLLocationManager instancesRespondToSelector:@selector(requestWhenInUseAuthorization)])
  3230 + {
  3231 + NSAssert([[[NSBundle mainBundle] infoDictionary] valueForKey:@"NSLocationWhenInUseUsageDescription"], @"For iOS 8 and above, your app must have a value for NSLocationWhenInUseUsageDescription in its Info.plist");
  3232 + [_locationManager requestWhenInUseAuthorization];
  3233 + }
  3234 +
3226 _locationManager.headingFilter = 5.0; 3235 _locationManager.headingFilter = 5.0;
3227 _locationManager.delegate = self; 3236 _locationManager.delegate = self;
3228 [_locationManager startUpdatingLocation]; 3237 [_locationManager startUpdatingLocation];