From e10360f34a581347a6af685b21662ff5c5341cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Fri, 27 Jan 2017 00:48:50 -0800 Subject: [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. --- platform/macos/src/MGLMapView.mm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'platform/macos/src') 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; -- cgit v1.2.1