From fdfa9cc4f436c0d224028e0714f67b780751e12c Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Thu, 6 Apr 2017 10:58:38 -0400 Subject: =?UTF-8?q?If=20the=20resources=20bundle=20contains=20an=20inner?= =?UTF-8?q?=20bundle,=20it=E2=80=99s=20a=20Cocoapods=20resources=20bundle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SmartDeviceLink/NSBundle+SDLBundle.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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]; -- cgit v1.2.1