IOS 获取系统版本号

来源:互联网 发布:三国志9汉献帝数据 编辑:程序博客网 时间:2024/05/05 18:06

看代码的时候看到一句,用于获取.plist文件的版本号

[objc] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. labelVersion.text = [NSString stringWithFormat:@"v%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*)kCFBundleVersionKey]];  



比较感兴趣的是后面的参数 kcFBundleVersionKey ,竟然是CFBundle.h已经定于好的属性,下面有这个属性的注释

const CFStringRef kCFBundleVersionKey;

    /* The version number of the bundle.  For Mac OS 9 style version numbers (for example "2.5.3d5"), */

    /* clients can use CFBundleGetVersionNumber() instead of accessing this key directly since that */

    /* function will properly convert the version string into its compact integer representation. */

还有好多是kcFXXX开头的Standard Info.plist keys 属性,有兴趣可以自己看一下CFBundle.h,研究一下它们的用法,
0 0
原创粉丝点击