【发布时间】:2014-08-23 15:55:04
【问题描述】:
这可能不仅限于iOS Universal Frameworks,而是所有 xxx.framework 文件。但是,我似乎找不到有关如何在客户端应用程序中获取当前版本和构建框架的文档。在应用程序中,您可以使用以下内容:
NSString *name = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
这将为您提供存储在应用程序的 Info.plist 中的当前信息。但是我们如何找到框架的信息。就我而言,特别是嵌入式框架。
【问题讨论】:
-
你做到了吗?
-
不,恐怕不会。然而,我们正在从 iOS 通用框架迁移到原生 Xcode 6 Cocoa Touch 框架,也许我们会在那里有更好的运气。如果我弄明白了,我会在这里更新。
-
感谢您的确认
-
如果它是您的嵌入式框架,您可以提供一些可供客户端访问的方法或属性,这些方法或属性将指向:[[[NSBundle bundleForClass:[MyFrameworkClass class]] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ;
-
这就是我获取框架包的方式 -NSBundle *rampBundle = [NSBundle bundleWithIdentifier:@"com.example.framework"];
标签: ios cocoa-touch frameworks ios-universal-framework