Get version number of iOS Universal Framework in client(在客户端获取 iOS 通用框架的版本号)
问题描述
这可能不仅限于 iOS 通用框架,而是所有 xxx.framework 文件.但是,我似乎找不到有关如何在客户端应用程序中获取当前版本和构建框架的文档.在应用程序中,您可以使用以下内容:
This is likely not limited to iOS Universal Frameworks but all xxx.framework files. However I can't seem to find documentation on how to get the current version and build of a framework within the client application. Within an app you'd use something like:
NSString *name = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
这将为您提供存储在应用程序的 Info.plist 中的当前信息.但是我们如何找到框架的信息.就我而言,特别是嵌入式框架.
That would give you the current information stored in the Info.plist for the app. But how to we find that information for a framework. And in my case, specifically an embedded framework.
推荐答案
我发现 Xcode 6 支持 Apple 新的 Cocoa Touch 框架,为这个问题提供了一个简单的答案.在为您创建的默认头文件中,例如 Framework.h
,您将看到为您声明的两个常量.这些稍后可能由内部框架逻辑在运行时定义.但我已确认它们已从框架的 plist 中删除.
I have found that Apple's new Cocoa Touch frameworks supported in Xcode 6, offer an easy answer to this problem. In the default header file created for you, something like Framework.h
, you'll see two constants declared for you. These are defined later presumably at runtime by internal framework logic. But I have confirmed they're pulled from the plist for the framework.
//! Project version number for LocalSearch.
FOUNDATION_EXPORT double FrameworkVersionNumber;
//! Project version string for LocalSearch.
FOUNDATION_EXPORT const unsigned char FrameworkVersionString[];
这篇关于在客户端获取 iOS 通用框架的版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在客户端获取 iOS 通用框架的版本号


基础教程推荐
- 固定小数的Android Money Input 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01