iPhone/iPad IOS如何获取框架捆绑版本

ort*_*t11 6 frameworks ios

试图获得.framework的捆绑版本.试图找到使用资源路径的文件,然后使用NSBundle之类的东西......

    NSString *path = [[NSBundle mainBundle] pathForResource:@"SomeFramework" ofType:@"framework"];
    NSBundle *bundle = [[NSBundle alloc] initWithPath:path];
    _version = [bundle objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; 
Run Code Online (Sandbox Code Playgroud)

但路径一直没有回来......

更好的方法?

yas*_*h77 3

NSArray *ar = [NSBundle allFrameworks];

for (NSBundle *b in ar) {

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

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

}
Run Code Online (Sandbox Code Playgroud)