Created
December 4, 2014 19:02
-
-
Save sebk/aa778a3708726d52683b to your computer and use it in GitHub Desktop.
Get correct NSBundle for resource in a Cocoa Touch Framework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import UIKit; | |
@interface NSBundle (Framework) | |
+ (NSBundle*)bundleForFramework; | |
@end | |
#import "NSBundle+Framework.h" | |
@implementation NSBundle (Framework) | |
+ (NSBundle*)bundleForFramework { | |
NSArray *bundz = [[NSBundle bundleForClass:[self class]] URLsForResourcesWithExtension:@"framework" subdirectory:nil]; | |
for (NSURL *bundleURL in bundz){ | |
// This should force it to attempt to load. Don't worry if it says it can't find a class. | |
NSBundle *child = [NSBundle bundleWithURL:bundleURL]; | |
[child load]; | |
} | |
return [NSBundle bundleWithIdentifier: @"INSERT CORRECT BUNDLE IDENTIFIER" ]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment