summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-07-19 12:59:59 -0700
committerFabian Guerra <fabian.guerra@mapbox.com>2018-07-20 09:46:38 -0700
commitbe7018ad1a4bf078cd11b86d1eac38c3d70fb4ed (patch)
treeb82bad289539231a7940ce1ad98203b6394a4045
parent0453ade158b5b9430d68b5752afbcca988bc46f7 (diff)
downloadqtlocation-mapboxgl-be7018ad1a4bf078cd11b86d1eac38c3d70fb4ed.tar.gz
[ios] Clarify location manager API use.
-rw-r--r--platform/darwin/src/MGLLocationManager.h5
-rw-r--r--platform/darwin/src/MGLLocationManager.m1
-rw-r--r--platform/ios/src/MGLMapView.h10
-rw-r--r--platform/ios/src/MGLMapView.mm2
4 files changed, 9 insertions, 9 deletions
diff --git a/platform/darwin/src/MGLLocationManager.h b/platform/darwin/src/MGLLocationManager.h
index 1b2b17d83b..95c7b69e02 100644
--- a/platform/darwin/src/MGLLocationManager.h
+++ b/platform/darwin/src/MGLLocationManager.h
@@ -117,8 +117,9 @@ NS_ASSUME_NONNULL_BEGIN
@end
/**
- The `MGLLocationManagerDelegate` protocol defines a set of methods that `MGLMapView`
- uses to receive location updates from the associated location manager.
+ The `MGLLocationManagerDelegate` protocol defines a set of methods that respond
+ to location updates from an `MGLLocationManager` object that is serving as the
+ location manager of an `MGLMapView`.
*/
@protocol MGLLocationManagerDelegate <NSObject>
diff --git a/platform/darwin/src/MGLLocationManager.m b/platform/darwin/src/MGLLocationManager.m
index 7b65324b62..4a006232bc 100644
--- a/platform/darwin/src/MGLLocationManager.m
+++ b/platform/darwin/src/MGLLocationManager.m
@@ -81,6 +81,7 @@
{
[self.locationManager stopUpdatingLocation];
[self.locationManager stopUpdatingHeading];
+ self.locationManager.delegate = nil;
self.delegate = nil;
}
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index d588d357a7..b2439416ae 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -300,10 +300,8 @@ MGL_EXPORT IB_DESIGNABLE
The object that this map view uses to start and stop the delivery of location-related
updates.
- To receive the current user location implement `MGLMapViewDelegate`s delegate methods:
-
- `-[MGLMapViewDelegate mapView:didUpdateUserLocation:]`
- `-[MGLMapViewDelegate mapView:didFailToLocateUserWithError:]`
+ To receive the current user location, implement the `-[MGLMapViewDelegate mapView:didUpdateUserLocation:]`
+ and `-[MGLMapViewDelegate mapView:didFailToLocateUserWithError:]` methods.
If setting this property to `nil` and setting `showsUserLocation` to `YES`, or
if no custom manager is provided this property is set to the default
@@ -311,8 +309,8 @@ MGL_EXPORT IB_DESIGNABLE
`MGLMapView` uses a default location manager. If you want to substitute your own
location manager, you should do so by setting this property before setting
- `showsUserLocation` to `YES`. To restore the default location manager, set this
- property to `nil`.
+ `showsUserLocation` to `YES`. To restore the default location manager,
+ set this property to `nil`.
*/
@property (nonatomic, null_resettable) id<MGLLocationManager> locationManager;
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 81e13b54a7..0851744f7b 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -4695,8 +4695,8 @@ public:
if (!locationManager) {
[self.locationManager stopUpdatingLocation];
[self.locationManager stopUpdatingHeading];
- self.locationManager.delegate = nil;
}
+ self.locationManager.delegate = nil;
_locationManager = locationManager;
_locationManager.delegate = self;