summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-12-22 15:05:47 -0800
committerMinh Nguyễn <mxn@1ec5.org>2016-01-22 14:45:57 -0800
commit26578ea9d5a5e8e208a10c6c59f8bc8d5bca471e (patch)
tree89c1d6c6fa761e5a9510f09f65fefb2860a36e4c
parentf9360c3f4f0488ddfea9fb62e535cca251255155 (diff)
downloadqtlocation-mapboxgl-26578ea9d5a5e8e208a10c6c59f8bc8d5bca471e.tar.gz
[ios] Look for resources in static framework bundle
The library is packaged as a static framework, so there isn’t a separate resource bundle anymore. Instead, look for the static framework inside the Frameworks folder.
-rw-r--r--platform/ios/src/MGLMapView.mm11
-rw-r--r--platform/ios/src/NSBundle+MGLAdditions.m9
2 files changed, 10 insertions, 10 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index ebcc62eba6..8e5bdb96dd 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -3531,19 +3531,12 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
{
NSString *extension = imageName.pathExtension.length ? imageName.pathExtension : @"png";
NSBundle *bundle = [NSBundle mgl_frameworkBundle];
- NSString *directory = nil;
- if (![bundle.infoDictionary[@"CFBundlePackageType"] isEqualToString:@"FMWK"]) {
- // For static libraries, the bundle is the containing application bundle
- // and the resources are in a bundle alongside the static library.
- directory = @"Mapbox.bundle";
- }
NSString *path = [bundle pathForResource:imageName.stringByDeletingPathExtension
- ofType:extension
- inDirectory:directory];
+ ofType:extension];
if ( ! path)
{
[NSException raise:@"Resource not found" format:
- @"The resource named “%@” could not be found in the Mapbox resource bundle.", imageName];
+ @"The resource named “%@” could not be found in the Mapbox framework bundle.", imageName];
}
return [UIImage imageWithContentsOfFile:path];
diff --git a/platform/ios/src/NSBundle+MGLAdditions.m b/platform/ios/src/NSBundle+MGLAdditions.m
index 05d8f5c87c..868b4ff8e6 100644
--- a/platform/ios/src/NSBundle+MGLAdditions.m
+++ b/platform/ios/src/NSBundle+MGLAdditions.m
@@ -8,7 +8,14 @@ void mgl_linkBundleCategory() {}
+ (instancetype)mgl_frameworkBundle
{
- return [self bundleForClass:[MGLAccountManager class]];
+ NSBundle *bundle = [self bundleForClass:[MGLAccountManager class]];
+ if (![bundle.infoDictionary[@"CFBundlePackageType"] isEqualToString:@"FMWK"]) {
+ // For static frameworks, the bundle is the containing application
+ // bundle but the resources are still in the framework bundle.
+ bundle = [NSBundle bundleWithPath:[bundle.privateFrameworksPath
+ stringByAppendingPathComponent:@"Mapbox.framework"]];
+ }
+ return bundle;
}
@end