summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2017-07-31 16:18:24 -0400
committerJason Wray <jason@mapbox.com>2017-07-31 17:55:49 -0400
commitc36e08b97658c07bb74cd950942ff6bcd98fdb06 (patch)
tree88b665b2fd7f10c5e16c2284b0e2bf490787775c
parent9c01cbc537f17f886bce45ce5927bef8a6c50d63 (diff)
downloadqtlocation-mapboxgl-upstream/9639-ianthetechie-cllocation-nil.tar.gz
Return an invalid `coordinate` when `location` is nilupstream/9639-ianthetechie-cllocation-nil
With _location no longer initialized to an invalid coordinate, trying to access `_location.coordinate` when `_location == nil` will return `0, 0`, which is a valid coordinate.
-rw-r--r--platform/ios/CHANGELOG.md4
-rw-r--r--platform/ios/src/MGLUserLocation.h3
-rw-r--r--platform/ios/src/MGLUserLocation.m2
3 files changed, 6 insertions, 3 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 43df49a9ac..2be8c56d06 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -2,6 +2,10 @@
Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.
+## 3.6.2
+
+* Fixed an issue where `MGLUserLocation.location` did not follow its documented initialization behavior. This property will now properly return `nil` until the user’s location has been determined. ([#9639](https://github.com/mapbox/mapbox-gl-native/pull/9639))
+
## 3.6.1
* Reduced the size of the dynamic framework by optimizing symbol visibility. ([#7604](https://github.com/mapbox/mapbox-gl-native/pull/7604))
diff --git a/platform/ios/src/MGLUserLocation.h b/platform/ios/src/MGLUserLocation.h
index 8c6fe46136..91abadbcb7 100644
--- a/platform/ios/src/MGLUserLocation.h
+++ b/platform/ios/src/MGLUserLocation.h
@@ -20,8 +20,7 @@ MGL_EXPORT
/**
The current location of the device. (read-only)
- This property contains `nil` if the map view is not currently showing the user
- location or if the user’s location has not yet been determined.
+ This property returns `nil` if the user’s location has not yet been determined.
*/
@property (nonatomic, readonly, nullable) CLLocation *location;
diff --git a/platform/ios/src/MGLUserLocation.m b/platform/ios/src/MGLUserLocation.m
index 1e38689cb3..074d138a72 100644
--- a/platform/ios/src/MGLUserLocation.m
+++ b/platform/ios/src/MGLUserLocation.m
@@ -101,7 +101,7 @@ NS_ASSUME_NONNULL_END
- (CLLocationCoordinate2D)coordinate
{
- return self.location.coordinate;
+ return _location ? _location.coordinate : kCLLocationCoordinate2DInvalid;
}
- (NSString *)title