move to actual NSURL type

This commit is contained in:
Justin R. Miller
2015-03-30 22:30:06 -07:00
parent 2782a8ce5b
commit 33f14328c4

View File

@@ -139,7 +139,7 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
if (self && [self commonInit])
{
if (accessToken) [self setAccessToken:accessToken];
if (styleURL) [self setStyleURL:[styleURL absoluteString]];
if (styleURL) [self setStyleURL:styleURL];
}
return self;
@@ -185,17 +185,17 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
}
}
- (void)setStyleURL:(NSString *)styleURLString
- (void)setStyleURL:(NSURL *)styleURL
{
std::string styleURL([styleURLString UTF8String]);
std::string styleURLString([[styleURL absoluteString] UTF8String]);
if ( ! [[NSURL URLWithString:styleURLString] scheme])
if ( ! [styleURL scheme])
{
mbglMap->setStyleURL(std::string("asset://") + styleURL);
mbglMap->setStyleURL(std::string("asset://") + styleURLString);
}
else
{
mbglMap->setStyleURL(styleURL);
mbglMap->setStyleURL(styleURLString);
}
}
@@ -1320,7 +1320,7 @@ CLLocationCoordinate2D latLngToCoordinate(mbgl::LatLng latLng)
if (isHybrid) {
styleName = [@"satellite-" stringByAppendingString:[styleName substringFromIndex:[hybridStylePrefix length]]];
}
[self setStyleURL:[NSString stringWithFormat:@"styles/%@.json", styleName]];
[self setStyleURL:[NSURL URLWithString:[NSString stringWithFormat:@"styles/%@.json", styleName]]];
if (isHybrid) {
[self setStyleClasses:@[@"contours", @"labels"]];
}