Reputation: 3349
Trying to get a .framework 's bundle version. Tried to find the file using path for resource and then use NSBundle something like...
NSString *path = [[NSBundle mainBundle] pathForResource:@"SomeFramework" ofType:@"framework"];
NSBundle *bundle = [[NSBundle alloc] initWithPath:path];
_version = [bundle objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
But path keeps coming back nil......
Better way?
Upvotes: 6
Views: 1987
Reputation: 1870
NSArray *ar = [NSBundle allFrameworks];
for (NSBundle *b in ar) {
NSLog(@"%@",[b objectForInfoDictionaryKey:@"CFBundleName"]);
NSLog(@"%@",[b objectForInfoDictionaryKey:@"CFBundleShortVersionString"]);
}
Upvotes: 3