diff options
author | Justin R. Miller <incanus@codesorcery.net> | 2015-11-13 17:22:01 -0800 |
---|---|---|
committer | Justin R. Miller <incanus@codesorcery.net> | 2015-11-16 11:58:28 -0800 |
commit | 2a78b17698c967d380418529f09808d3dc63b19b (patch) | |
tree | 7ca31725825258491652f9d64d0978ef0dad6a4f /platform | |
parent | 8e6b9a0d965eaa173a6d2cf55658b3ee74d2e3c3 (diff) | |
download | qtlocation-mapboxgl-2a78b17698c967d380418529f09808d3dc63b19b.tar.gz |
provide resource bundle search for premade frameworks
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/NSBundle+MGLAdditions.m | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/platform/ios/NSBundle+MGLAdditions.m b/platform/ios/NSBundle+MGLAdditions.m index 3fca7384a3..d5842ea596 100644 --- a/platform/ios/NSBundle+MGLAdditions.m +++ b/platform/ios/NSBundle+MGLAdditions.m @@ -8,8 +8,21 @@ void mgl_linkBundleCategory(){} + (NSString *)mgl_resourceBundlePath { - NSString *resourceBundlePath = [[NSBundle bundleForClass:[MGLMapView class]] pathForResource:@"Mapbox" ofType:@"bundle"]; + NSString *resourceBundlePath = nil; + // check for resource bundle in framework bundle (Fabric, premade framework) + // + NSString *frameworkBundlePath = [NSString stringWithFormat:@"%@/Mapbox.framework/Mapbox.bundle", + [[NSBundle mainBundle] privateFrameworksPath]]; + if ([NSBundle bundleWithPath:frameworkBundlePath]) resourceBundlePath = frameworkBundlePath; + + // check for resource bundle in app bundle (static library) + // + if ( ! resourceBundlePath) resourceBundlePath = [[NSBundle bundleForClass: + [MGLMapView class]] pathForResource:@"Mapbox" ofType:@"bundle"]; + + // fall back to resources directly in app bundle (test app) + // if ( ! resourceBundlePath) resourceBundlePath = [[NSBundle mainBundle] bundlePath]; return resourceBundlePath; |