Skip to content

Instantly share code, notes, and snippets.

View sebastienbrault's full-sized avatar

Sébastien Brault sebastienbrault

View GitHub Profile
@sebastienbrault
sebastienbrault / gist:37d95c0c825f9afaab4e2680c486a848
Created April 7, 2016 07:56
How te retrieve the bundle identifier of a specific bundle
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);
}