Created
January 8, 2015 21:08
-
-
Save phatblat/04b8ef20654432ae6549 to your computer and use it in GitHub Desktop.
Find the main app bundle from inside an extension bundle
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
| NSBundle *bundle = [NSBundle mainBundle]; | |
| if ([[bundle.bundleURL pathExtension] isEqualToString:@"appex"]) { | |
| // Peel off two directory levels - MY_APP.app/PlugIns/MY_APP_EXTENSION.appex | |
| bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]]; | |
| } | |
| NSURL *url = [bundle URLForResource:... withExtension:...]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment