IOS 获取APP 版本号的实例详解

2025-05-29 0 80

IOS 获取APP 版本号的实例详解

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

?

1
labelVersion.text = [NSString stringWithFormat:@"v%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*)kCFBundleVersionKey]];

IOS 获取APP 版本号的实例详解

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

?

1

2

3

4
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,研究一下它们的用法,

以上就是IOS 获取APP 版本号的简单实例,关于IOS 开发的文章本站还有很多,大家可以参考,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

快网idc优惠网 建站教程 IOS 获取APP 版本号的实例详解 https://www.kuaiidc.com/90832.html

相关文章

发表评论
暂无评论