Created
April 7, 2016 07:56
-
-
Save sebastienbrault/37d95c0c825f9afaab4e2680c486a848 to your computer and use it in GitHub Desktop.
How te retrieve the bundle identifier of a specific bundle
This file contains 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
NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:[[NSBundle mainBundle] bundlePath] error:NULL]; | |
for (NSString *fileName in files) | |
{ | |
NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:nil]; | |
NSURL *url = [NSURL fileURLWithPath:path]; | |
// do something with `url` | |
if ([fileName isEqualToString:@"MY_BUNDLE.bundle"]) | |
{ | |
NSLog(@"Found id : %@ for bundle : %@", [[NSBundle bundleWithURL:url] bundleIdentifier], fileName); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment