ort11
ort11

Reputation: 3349

iPhone / iPad IOS How To Get Framework Bundle Version

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

Answers (1)

yashwanth77
yashwanth77

Reputation: 1870

NSArray *ar = [NSBundle allFrameworks];

for (NSBundle *b in ar) {

NSLog(@"%@",[b objectForInfoDictionaryKey:@"CFBundleName"]);

NSLog(@"%@",[b objectForInfoDictionaryKey:@"CFBundleShortVersionString"]);

}

Upvotes: 3

Related Questions