diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index ebcc62eba..8e5bdb96d 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 05d8f5c87..868b4ff8e 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