diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-08-16 01:17:11 -0700 |
---|---|---|
committer | Fredrik Karlsson <bjorn.fredrik.karlsson@gmail.com> | 2016-08-16 10:17:11 +0200 |
commit | 1daba5d04b5f6a704a1ee608b64b7bb42101903f (patch) | |
tree | 50f268ad3dfc459f9814ed2a516c8127786a09b3 /platform | |
parent | 6c6ddd9e86d1be7257178ffd123dde5138d6c7b9 (diff) | |
download | qtlocation-mapboxgl-1daba5d04b5f6a704a1ee608b64b7bb42101903f.tar.gz |
[ios, macos] Accept absolute file paths as style URLs (#6026)
It turns out that mbgl::AssetFileSource supports absolute file URLs in addition to relative file URLs. So replace the file: scheme with asset: while percent-escaping as necessary.
Also added amsterdam.geojson to macos.xcodeproj for consistency with ios.xcodeproj.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/darwin/src/NSURL+MGLAdditions.h | 17 | ||||
-rw-r--r-- | platform/darwin/src/NSURL+MGLAdditions.m | 21 | ||||
-rw-r--r-- | platform/ios/CHANGELOG.md | 1 | ||||
-rw-r--r-- | platform/ios/ios.xcodeproj/project.pbxproj | 16 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 8 | ||||
-rw-r--r-- | platform/macos/CHANGELOG.md | 1 | ||||
-rw-r--r-- | platform/macos/macos.xcodeproj/project.pbxproj | 14 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 7 |
8 files changed, 73 insertions, 12 deletions
diff --git a/platform/darwin/src/NSURL+MGLAdditions.h b/platform/darwin/src/NSURL+MGLAdditions.h new file mode 100644 index 0000000000..70fd79f064 --- /dev/null +++ b/platform/darwin/src/NSURL+MGLAdditions.h @@ -0,0 +1,17 @@ +#import <Foundation/Foundation.h> + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface NSURL (MGLAdditions) + +/** + Returns the given URL, modified if necessary to use the asset: URL scheme + expected by mbgl for local requests. + */ +- (nullable NSURL *)mgl_URLByStandardizingScheme; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/NSURL+MGLAdditions.m b/platform/darwin/src/NSURL+MGLAdditions.m new file mode 100644 index 0000000000..11b84ed8fa --- /dev/null +++ b/platform/darwin/src/NSURL+MGLAdditions.m @@ -0,0 +1,21 @@ +#import "NSURL+MGLAdditions.h" + +@implementation NSURL (MGLAdditions) + +- (nullable NSURL *)mgl_URLByStandardizingScheme { + if (!self.scheme) { + // Relative file URL, already escaped (in order to create the NSURL). + // Assume a relative path into the application’s resource folder. + return [NSURL URLWithString:[@"asset://" stringByAppendingString:self.absoluteString]]; + } else if (self.fileURL) { + // Absolute file URL, so construct a new URL using the unescaped path. + NSURLComponents *components = [[NSURLComponents alloc] init]; + components.scheme = @"asset"; + components.host = @""; + components.path = self.path; + return components.URL; + } + return self; +} + +@end diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index f9ea54f0cd..adb59898bd 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -10,6 +10,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Fixed an issue causing the wrong annotation view to be selected when tapping an annotation view with a center offset applied. ([#5931](https://github.com/mapbox/mapbox-gl-native/pull/5931)) * Fixed an issue allowing annotation views to be assigned to polyline and polygon annotations. ([#5770](https://github.com/mapbox/mapbox-gl-native/pull/5770)) * Per documentation, the first and last coordinates in an MGLPolygon must be identical in order for the polygon to draw correctly. The same is true for an MGLPolygon’s interior polygon. ([#5514](https://github.com/mapbox/mapbox-gl-native/pull/5514)) +* MGLMapView’s `styleURL` property can now be set to an absolute file URL. ([#6026](https://github.com/mapbox/mapbox-gl-native/pull/6026)) * GeoJSON sources specified by the stylesheet at design time now support `cluster`, `clusterMaxZoom`, and `clusterRadius` attributes for clustering point features on the base map. ([#5724](https://github.com/mapbox/mapbox-gl-native/pull/5724)) * Added [quadkey](https://msdn.microsoft.com/en-us/library/bb259689.aspx) support and limited WMS support in raster tile URL templates. ([#5628](https://github.com/mapbox/mapbox-gl-native/pull/5628)) * 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)) diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 61f61e970f..f822e587d4 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -53,6 +53,7 @@ 35136D4F1D4277FC00C20EFD /* MGLSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D4B1D4277FC00C20EFD /* MGLSource.mm */; }; 35305D481D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */; }; 35305D491D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */; }; + 35305D4A1D22AA6A0007D005 /* NSData+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */; }; 353349B31D5CC6F20094E9DE /* amsterdam.geojson in Resources */ = {isa = PBXBuildFile; fileRef = 353349B21D5CC6F20094E9DE /* amsterdam.geojson */; }; 3534C7921D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3534C7911D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.hpp */; }; 3534C7931D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3534C7911D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.hpp */; }; @@ -76,7 +77,6 @@ 353933FC1D3FB7C0003F57D7 /* MGLRasterStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 353933FA1D3FB7C0003F57D7 /* MGLRasterStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 353933FE1D3FB7DD003F57D7 /* MGLSymbolStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 353933FD1D3FB7DD003F57D7 /* MGLSymbolStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 353933FF1D3FB7DD003F57D7 /* MGLSymbolStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 353933FD1D3FB7DD003F57D7 /* MGLSymbolStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 35305D4A1D22AA6A0007D005 /* NSData+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */; }; 353D23961D0B0DFE002BE09D /* MGLAnnotationViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 353D23951D0B0DFE002BE09D /* MGLAnnotationViewTests.m */; }; 354D42DC1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 354D42DB1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.hpp */; }; 354D42DD1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 354D42DB1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.hpp */; }; @@ -364,6 +364,11 @@ DAD165791CF4CDFF001FF4B9 /* MGLShapeCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = DAD165761CF4CDFF001FF4B9 /* MGLShapeCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; DAD1657A1CF4CDFF001FF4B9 /* MGLShapeCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD165771CF4CDFF001FF4B9 /* MGLShapeCollection.m */; }; DAD1657B1CF4CDFF001FF4B9 /* MGLShapeCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD165771CF4CDFF001FF4B9 /* MGLShapeCollection.m */; }; + DAED385C1D62802D00D7640F /* amsterdam.geojson in Resources */ = {isa = PBXBuildFile; fileRef = 353349B21D5CC6F20094E9DE /* amsterdam.geojson */; }; + DAED38631D62D0FC00D7640F /* NSURL+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED38611D62D0FC00D7640F /* NSURL+MGLAdditions.h */; }; + DAED38641D62D0FC00D7640F /* NSURL+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED38611D62D0FC00D7640F /* NSURL+MGLAdditions.h */; }; + DAED38651D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DAED38621D62D0FC00D7640F /* NSURL+MGLAdditions.m */; }; + DAED38661D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DAED38621D62D0FC00D7640F /* NSURL+MGLAdditions.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -695,6 +700,8 @@ DAD1656B1CF41981001FF4B9 /* MGLFeature.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLFeature.mm; sourceTree = "<group>"; }; DAD165761CF4CDFF001FF4B9 /* MGLShapeCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeCollection.h; sourceTree = "<group>"; }; DAD165771CF4CDFF001FF4B9 /* MGLShapeCollection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLShapeCollection.m; sourceTree = "<group>"; }; + DAED38611D62D0FC00D7640F /* NSURL+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+MGLAdditions.h"; sourceTree = "<group>"; }; + DAED38621D62D0FC00D7640F /* NSURL+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+MGLAdditions.m"; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1236,6 +1243,8 @@ DA8848161CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.m */, DA8848171CBAFA6200AB86E3 /* NSString+MGLAdditions.h */, DA8848181CBAFA6200AB86E3 /* NSString+MGLAdditions.m */, + DAED38611D62D0FC00D7640F /* NSURL+MGLAdditions.h */, + DAED38621D62D0FC00D7640F /* NSURL+MGLAdditions.m */, DA35A2C71CCAAAD200E826B2 /* NSValue+MGLAdditions.h */, DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */, ); @@ -1335,6 +1344,7 @@ DA88483D1CBAFB8500AB86E3 /* MGLMapView+IBAdditions.h in Headers */, DA17BE301CC4BAC300402C41 /* MGLMapView_Private.hpp in Headers */, DAD165781CF4CDFF001FF4B9 /* MGLShapeCollection.h in Headers */, + DAED38631D62D0FC00D7640F /* NSURL+MGLAdditions.h in Headers */, DA88481E1CBAFA6200AB86E3 /* MGLMultiPoint_Private.h in Headers */, 3566C7661D4A77BA008152BC /* MGLGeoJSONSource.h in Headers */, 35CE61821D4165D9004F2359 /* UIColor+MGLAdditions.hpp in Headers */, @@ -1389,6 +1399,7 @@ 350098BC1D480108004B2AF0 /* MGLVectorSource.h in Headers */, 353933FC1D3FB7C0003F57D7 /* MGLRasterStyleLayer.h in Headers */, 3566C76D1D4A8DFA008152BC /* MGLRasterSource.h in Headers */, + DAED38641D62D0FC00D7640F /* NSURL+MGLAdditions.h in Headers */, 35599DEC1D46F14E0048254D /* MGLStyleAttributeFunction.h in Headers */, DABFB85E1CBE99E500D62B32 /* MGLAnnotation.h in Headers */, 350098D01D482E10004B2AF0 /* NSArray+MGLStyleAttributeAdditions_Private.hpp in Headers */, @@ -1644,6 +1655,7 @@ files = ( DA25D5CD1CCDA11500607828 /* Settings.bundle in Resources */, DA1DC9701CB6C6CE006E619F /* points.geojson in Resources */, + DAED385C1D62802D00D7640F /* amsterdam.geojson in Resources */, DA1DC9711CB6C6CE006E619F /* polyline.geojson in Resources */, DA1DC99D1CB6E076006E619F /* Default-568h@2x.png in Resources */, DA821D071CCC6D59007508D4 /* Main.storyboard in Resources */, @@ -1781,6 +1793,7 @@ DA88485D1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.m in Sources */, 3593E5231D529C29006D9365 /* MGLStyleAttribute.mm in Sources */, 350098B11D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm in Sources */, + DAED38651D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */, DAD165701CF41981001FF4B9 /* MGLFeature.mm in Sources */, 350098C31D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm in Sources */, 40EDA1C11CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */, @@ -1843,6 +1856,7 @@ DAA4E4221CBB730400178DFB /* MGLPointAnnotation.m in Sources */, 3593E5241D529C29006D9365 /* MGLStyleAttribute.mm in Sources */, 350098B21D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm in Sources */, + DAED38661D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */, DAD165711CF41981001FF4B9 /* MGLFeature.mm in Sources */, 350098C41D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm in Sources */, 40EDA1C21CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */, diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 113bd2cef6..766e7e64f0 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -36,6 +36,7 @@ #import "NSProcessInfo+MGLAdditions.h" #import "NSException+MGLAdditions.h" #import "UIColor+MGLAdditions.hpp" +#import "NSURL+MGLAdditions.h" #import "MGLUserLocationAnnotationView.h" #import "MGLUserLocation_Private.h" #import "MGLAnnotationImage_Private.h" @@ -345,12 +346,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]; } - if ( ! [styleURL scheme]) - { - // Assume a relative path into the application bundle. - styleURL = [NSURL URLWithString:[@"asset://" stringByAppendingString:[styleURL absoluteString]]]; - } - + styleURL = styleURL.mgl_URLByStandardizingScheme; _mbglMap->setStyleURL([[styleURL absoluteString] UTF8String]); } diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 067149fdb6..05227a4134 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -5,6 +5,7 @@ * Fixed an issue causing code signing failures and bloating the framework. ([#5850](https://github.com/mapbox/mapbox-gl-native/pull/5850)) * A new runtime styling API allows you to adjust the style and content of the base map dynamically. All the options available in [Mapbox Studio](https://www.mapbox.com/studio/) are now exposed via MGLStyle and subclasses of MGLStyleLayer and MGLSource. ([#5727](https://github.com/mapbox/mapbox-gl-native/pull/5727)) * Added `showAnnotations:animated:` and `showAnnotations:edgePadding:animated:`, which moves the map viewport to show the specified annotations. ([#5749](https://github.com/mapbox/mapbox-gl-native/pull/5749)) +* MGLMapView’s `styleURL` property can now be set to an absolute file URL. ([#6026](https://github.com/mapbox/mapbox-gl-native/pull/6026)) * GeoJSON sources specified by the stylesheet at design time now support `cluster`, `clusterMaxZoom`, and `clusterRadius` attributes for clustering point features on the base map. ([#5724](https://github.com/mapbox/mapbox-gl-native/pull/5724)) * 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)) diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index 18a7f93232..181ed3fd64 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -166,6 +166,10 @@ DAE6C3D41CC34C9900DB3429 /* MGLOfflineRegionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3CA1CC34BD800DB3429 /* MGLOfflineRegionTests.m */; }; DAE6C3D51CC34C9900DB3429 /* MGLOfflineStorageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3CB1CC34BD800DB3429 /* MGLOfflineStorageTests.m */; }; DAE6C3D61CC34C9900DB3429 /* MGLStyleTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3CC1CC34BD800DB3429 /* MGLStyleTests.mm */; }; + DAED385A1D627FF400D7640F /* amsterdam.geojson in Resources */ = {isa = PBXBuildFile; fileRef = DAED38591D627FF400D7640F /* amsterdam.geojson */; }; + DAED385F1D62CED700D7640F /* NSURL+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED385D1D62CED700D7640F /* NSURL+MGLAdditions.h */; }; + DAED38601D62CED700D7640F /* NSURL+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DAED385E1D62CED700D7640F /* NSURL+MGLAdditions.m */; }; + DAED38671D62D2EB00D7640F /* amsterdam.geojson in Resources */ = {isa = PBXBuildFile; fileRef = DAED38591D627FF400D7640F /* amsterdam.geojson */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -384,6 +388,9 @@ DAE6C3CA1CC34BD800DB3429 /* MGLOfflineRegionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflineRegionTests.m; path = ../../darwin/test/MGLOfflineRegionTests.m; sourceTree = "<group>"; }; DAE6C3CB1CC34BD800DB3429 /* MGLOfflineStorageTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflineStorageTests.m; path = ../../darwin/test/MGLOfflineStorageTests.m; sourceTree = "<group>"; }; DAE6C3CC1CC34BD800DB3429 /* MGLStyleTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLStyleTests.mm; path = ../../darwin/test/MGLStyleTests.mm; sourceTree = "<group>"; }; + DAED38591D627FF400D7640F /* amsterdam.geojson */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = amsterdam.geojson; sourceTree = "<group>"; }; + DAED385D1D62CED700D7640F /* NSURL+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+MGLAdditions.h"; sourceTree = "<group>"; }; + DAED385E1D62CED700D7640F /* NSURL+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+MGLAdditions.m"; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -597,6 +604,7 @@ DA8F257D1D51C5F40010E6B5 /* Styling */ = { isa = PBXGroup; children = ( + DAED38591D627FF400D7640F /* amsterdam.geojson */, DA8F257C1D51C5F40010E6B5 /* Layers */, ); name = Styling; @@ -682,6 +690,8 @@ DAE6C3811CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.m */, DAE6C3821CC31E2A00DB3429 /* NSString+MGLAdditions.h */, DAE6C3831CC31E2A00DB3429 /* NSString+MGLAdditions.m */, + DAED385D1D62CED700D7640F /* NSURL+MGLAdditions.h */, + DAED385E1D62CED700D7640F /* NSURL+MGLAdditions.m */, DA35A2CD1CCAAED300E826B2 /* NSValue+MGLAdditions.h */, DA35A2CE1CCAAED300E826B2 /* NSValue+MGLAdditions.m */, ); @@ -819,6 +829,7 @@ DAE6C35E1CC31E0400DB3429 /* MGLMultiPoint.h in Headers */, 35602BFF1D3EA9B40050646F /* MGLStyleLayer_Private.hpp in Headers */, DAE6C3971CC31E2A00DB3429 /* NSBundle+MGLAdditions.h in Headers */, + DAED385F1D62CED700D7640F /* NSURL+MGLAdditions.h in Headers */, DAD165741CF4CD7A001FF4B9 /* MGLShapeCollection.h in Headers */, DA8F25AF1D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.h in Headers */, DAE6C3631CC31E0400DB3429 /* MGLPointAnnotation.h in Headers */, @@ -1004,6 +1015,7 @@ files = ( DA839EA21CC2E3400062CAFB /* Assets.xcassets in Resources */, DA839EA01CC2E3400062CAFB /* MapDocument.xib in Resources */, + DAED38671D62D2EB00D7640F /* amsterdam.geojson in Resources */, DA839EA51CC2E3400062CAFB /* MainMenu.xib in Resources */, DA5589771D320C41006B7F64 /* wms.json in Resources */, DAE6C2E21CC304F900DB3429 /* Credits.rtf in Resources */, @@ -1027,6 +1039,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + DAED385A1D627FF400D7640F /* amsterdam.geojson in Resources */, DA2DBBCB1D51E30A00D38FF9 /* MGLStyleLayerTests.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1085,6 +1098,7 @@ DAE6C3911CC31E2A00DB3429 /* MGLPolygon.mm in Sources */, DAE6C39B1CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.m in Sources */, DAE6C38F1CC31E2A00DB3429 /* MGLOfflineStorage.mm in Sources */, + DAED38601D62CED700D7640F /* NSURL+MGLAdditions.m in Sources */, DAE6C3951CC31E2A00DB3429 /* MGLTilePyramidOfflineRegion.mm in Sources */, 3593E52B1D52A628006D9365 /* MGLStyleAttribute.mm in Sources */, DAE6C3851CC31E2A00DB3429 /* MGLAccountManager.m in Sources */, diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index de127a7481..c3cd4ef7dd 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -38,6 +38,7 @@ #import "NSException+MGLAdditions.h" #import "NSString+MGLAdditions.h" #import "NSColor+MGLAdditions.hpp" +#import "NSURL+MGLAdditions.h" #import <QuartzCore/QuartzCore.h> @@ -543,11 +544,7 @@ public: styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]; } - if (![styleURL scheme]) { - // Assume a relative path into the application’s resource folder. - styleURL = [NSURL URLWithString:[@"asset://" stringByAppendingString:styleURL.absoluteString]]; - } - + styleURL = styleURL.mgl_URLByStandardizingScheme; _mbglMap->setStyleURL(styleURL.absoluteString.UTF8String); } |