欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

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

程序员文章站 2023-12-18 21:12:28
ios 获取app 版本号的实例详解 看代码的时候看到一句,用于获取.plist文件的版本号 labelversion.text = [nsstring s...

ios 获取app 版本号的实例详解

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

labelversion.text = [nsstring stringwithformat:@"v%@", [[nsbundle mainbundle] objectforinfodictionarykey:(nsstring*)kcfbundleversionkey]]; 

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

比较感兴趣的是后面的参数 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,研究一下它们的用法,

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

上一篇:

下一篇: