summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-01-27 00:48:50 -0800
committerMinh Nguyễn <mxn@1ec5.org>2017-01-27 09:14:02 -0800
commite10360f34a581347a6af685b21662ff5c5341cb3 (patch)
treef668d9db036caa8cb2d876c30456501b3111de7e
parenta19ce69455cd5230567d833ebbf1666fb8470295 (diff)
downloadqtlocation-mapboxgl-e10360f34a581347a6af685b21662ff5c5341cb3.tar.gz
[macos] Warn if access token needed but not given
When setting a nil style URL or any mapbox: style URL, if no access token has been provided, log a warning instead of asserting.
-rw-r--r--platform/macos/src/MGLMapView.mm11
1 files changed, 6 insertions, 5 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index 4e8f3c2b88..9cbc923271 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -610,13 +610,14 @@ public:
// Default to Streets.
if (!styleURL) {
- // An access token is required to load any default style, including
- // Streets.
- if (![MGLAccountManager accessToken]) {
- return;
- }
styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion];
}
+
+ // An access token is required to load any default style, including Streets.
+ if (![MGLAccountManager accessToken] && [styleURL.scheme isEqualToString:@"mapbox"]) {
+ NSLog(@"Cannot set the style URL to %@ because no access token has been specified.", styleURL);
+ return;
+ }
styleURL = styleURL.mgl_URLByStandardizingScheme;
self.style = nil;