[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.
This commit is contained in:
Minh Nguyễn
2017-01-27 00:48:50 -08:00
committed by Minh Nguyễn
parent a19ce69455
commit e10360f34a

View File

@@ -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;