从Info.plist中读取版本 [英] Read version from Info.plist

查看:313
本文介绍了从Info.plist中读取版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Info.plist读取包版本信息到我的代码,最好是一个字符串。

I want to read the bundle version info from Info.plist into my code, preferably as a string. How can I do this?

推荐答案

您可以使用

[[NSBundle mainBundle] infoDictionary]

您可以轻松地在 CFBundleVersion 键获得版本。

And you can easily get the version at the CFBundleVersion key that way.

最后,版本与

NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
NSString* version = [infoDict objectForKey:@"CFBundleVersion"];

这篇关于从Info.plist中读取版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆