summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-08-24 14:47:28 -0700
committerGitHub <noreply@github.com>2016-08-24 14:47:28 -0700
commit5836738906292d70b4f95166c7d5e58a97d1208d (patch)
tree6a90de60ccfe24539acfa2f5b844038e0eea79d5 /platform/macos
parent4579fa031e5d871ff18dc1b1d3e9eef3e6b73f13 (diff)
downloadqtlocation-mapboxgl-5836738906292d70b4f95166c7d5e58a97d1208d.tar.gz
Document -mapViewDidFailLoadingMap:withError: (#6145)
* [macos] Implement -mapViewDidFailLoadingMap:withError: * [ios] Documented -mapViewDidFailLoadingMap:withError:
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/CHANGELOG.md1
-rw-r--r--platform/macos/src/MGLMapView.mm5
-rw-r--r--platform/macos/src/MGLMapViewDelegate.h13
3 files changed, 18 insertions, 1 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index d0d2d0b5ae..1e53222cb4 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -15,6 +15,7 @@
* Fixed rendering artifacts and missing glyphs that occurred after viewing a large number of CJK characters on the map. ([#5908](https://github.com/mapbox/mapbox-gl-native/pull/5908))
* Improved the precision of annotations at zoom levels greater than 18. ([#5517](https://github.com/mapbox/mapbox-gl-native/pull/5517))
* Fixed an issue where the style zoom levels were not respected when deciding when to render a layer. ([#5811](https://github.com/mapbox/mapbox-gl-native/issues/5811))
+* If MGLMapView is unable to obtain or parse a style, it now calls its delegate’s `-mapViewDidFailLoadingMap:withError:` method. ([#6145](https://github.com/mapbox/mapbox-gl-native/pull/6145))
* Fixed crashes that could occur when loading a malformed stylesheet. ([#5736](https://github.com/mapbox/mapbox-gl-native/pull/5736))
* Fixed a typo in the documentation for the MGLCompassDirectionFormatter class. ([#5879](https://github.com/mapbox/mapbox-gl-native/pull/5879))
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index a222f55fa0..9507f5c433 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -807,7 +807,10 @@ public:
}
case mbgl::MapChangeDidFailLoadingMap:
{
- // Not yet implemented.
+ if ([self.delegate respondsToSelector:@selector(mapViewDidFailLoadingMap:withError:)]) {
+ NSError *error = [NSError errorWithDomain:MGLErrorDomain code:0 userInfo:nil];
+ [self.delegate mapViewDidFailLoadingMap:self withError:error];
+ }
break;
}
case mbgl::MapChangeWillStartRenderingMap:
diff --git a/platform/macos/src/MGLMapViewDelegate.h b/platform/macos/src/MGLMapViewDelegate.h
index c84ad42cf3..8f4922d304 100644
--- a/platform/macos/src/MGLMapViewDelegate.h
+++ b/platform/macos/src/MGLMapViewDelegate.h
@@ -83,6 +83,19 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView;
+/**
+ Tells the delegate that the map view was unable to load data needed for
+ displaying the map.
+
+ This method may be called for a variety of reasons, including a network
+ connection failure or a failure to fetch the style from the server. You can use
+ the given error message to notify the user that map data is unavailable.
+
+ @param mapView The map view that is unable to load the data.
+ @param error The reason the data could not be loaded.
+ */
+- (void)mapViewDidFailLoadingMap:(MGLMapView *)mapView withError:(NSError *)error;
+
- (void)mapViewWillStartRenderingMap:(MGLMapView *)mapView;
- (void)mapViewDidFinishRenderingMap:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered;