summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-04-06 10:58:38 -0400
committerJoel Fischer <joeljfischer@gmail.com>2017-04-06 10:58:38 -0400
commitfdfa9cc4f436c0d224028e0714f67b780751e12c (patch)
tree19965896a5ffc75b350a7ac71696acee36483bb7
parentb9cf970c7390f02cdea95773c571811d4aba78f0 (diff)
downloadsdl_ios-hotfix/issue_601.tar.gz
If the resources bundle contains an inner bundle, it’s a Cocoapods resources bundlehotfix/issue_601
-rw-r--r--SmartDeviceLink/NSBundle+SDLBundle.m10
1 files changed, 9 insertions, 1 deletions
diff --git a/SmartDeviceLink/NSBundle+SDLBundle.m b/SmartDeviceLink/NSBundle+SDLBundle.m
index 032994883..5880a5927 100644
--- a/SmartDeviceLink/NSBundle+SDLBundle.m
+++ b/SmartDeviceLink/NSBundle+SDLBundle.m
@@ -22,7 +22,15 @@ NS_ASSUME_NONNULL_BEGIN
sdlBundle = [NSBundle bundleWithURL:sdlBundleURL];
}
if (sdlBundle == nil) {
- sdlBundle = [NSBundle bundleForClass:[SDLManager class]];
+ NSBundle *frameworkBundle = [NSBundle bundleForClass:[SDLManager class]];
+
+ // HAX: Cocoapods will have the bundle as an inner bundle that we need to unpack...because reasons. Otherwise it's just the bundle we need
+ NSURL *innerBundleURL = [frameworkBundle URLForResource:@"SmartDeviceLink" withExtension:@"bundle"];
+ if (innerBundleURL) {
+ sdlBundle = [NSBundle bundleWithURL:innerBundleURL];
+ } else {
+ sdlBundle = frameworkBundle;
+ }
}
if (sdlBundle == nil) {
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"SDL WARNING: The 'SmartDeviceLink.bundle' resources bundle was not found. If you are using cocoapods, try dragging the bundle from the SmartDeviceLink-iOS pod 'products' directory into your resources build phase. If this does not work, please go to the SDL slack at slack.smartdevicelink.com and explain your issue. You may disable the lockscreen in configuration to prevent this failure, for now." userInfo:nil];