Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone / iPad IOS How To Get Framework Bundle Version

Tags:

ios

frameworks

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?

like image 510
ort11 Avatar asked Sep 09 '13 14:09

ort11


People also ask

What is framework Xcode?

A framework is a bundle (a structured directory) that contains a dynamic shared library along with associated resources, such as nib files, image files, and header files. When you develop an application, your project links to one or more frameworks.

How do I check Xcframework version?

For xcode version click xcode>about xcode. For the framework just open a header file from that framework, usually in the comments on top the version is mentioned.

What is NS bundle?

A representation of the code and resources stored in a bundle directory on disk.

What is an iOS module?

Module: A set of parts that can be assembled into a structure. To Xcode, that means you can have a group of lines of code that you can (re)use in different places without having to write that code again.


1 Answers

NSArray *ar = [NSBundle allFrameworks];

for (NSBundle *b in ar) {

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

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

}
like image 97
yashwanth77 Avatar answered Oct 14 '22 23:10

yashwanth77