博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
获取项目的名称及版本号
阅读量:6969 次
发布时间:2019-06-27

本文共 2364 字,大约阅读时间需要 7 分钟。

 

NSString *executableFile = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey];

NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey];

 

还有其它很多信息可由infoDictionary获得,以下是官方文档里的说明:

information Property List Keys

Standard keys found in a bundle’s information property list file.
const CFStringRef kCFBundleInfoDictionaryVersionKey;
const CFStringRef kCFBundleExecutableKey;
const CFStringRef kCFBundleIdentifierKey;
const CFStringRef kCFBundleVersionKey;
const CFStringRef kCFBundleDevelopmentRegionKey;
const CFStringRef kCFBundleNameKey;
const CFStringRef kCFBundleLocalizationsKey;

Constants
kCFBundleInfoDictionaryVersionKey
The version of the information property list format.
Available in iOS 2.0 and later.
Declared in CFBundle.h.
kCFBundleExecutableKey
The name of the executable in this bundle (if any).
Available in iOS 2.0 and later.
Declared in CFBundle.h.
kCFBundleIdentifierKey
The bundle identifier.
Available in iOS 2.0 and later.
Declared in CFBundle.h.
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.
Available in iOS 2.0 and later.
Declared in CFBundle.h.
kCFBundleDevelopmentRegionKey
The name of the development language of the bundle.
When CFBundle looks for resources, the fallback is to look in the lproj whose name is given by the kCFBundleDevelopmentRegionKey in the Info.plist file. You must, therefore, ensure that a bundle contains an lproj with that exact name containing a copy of every localized resource, otherwise CFBundle cannot guarantee the fallback mechanism will work.
Available in iOS 2.0 and later.
Declared in CFBundle.h.
kCFBundleNameKey
The human-readable name of the bundle.
This key is often found in the InfoPlist.strings since it is usually localized.
Available in iOS 2.0 and later.
Declared in CFBundle.h.
kCFBundleLocalizationsKey
Allows an unbundled application that handles localization itself to specify which localizations it has available.
Available in iOS 2.0 and later.
Declared in CFBundle.h.
Declared In
CFBundle.h

转载于:https://www.cnblogs.com/pengyingh/articles/2516038.html

你可能感兴趣的文章
Linux运维的8个小时工作时间都做什么
查看>>
Java学习日志(20-2-IO流-Properties与流合并切割)
查看>>
Andrioid 中 Service 组件的使用
查看>>
让Spring Controller 的方法基本数据类型参数支持Bean Validation
查看>>
mybatis.xml(理解的相对局限)
查看>>
详解VirtualBox虚拟机的四种网络设置
查看>>
关于学习区块链的推荐内容
查看>>
【腾讯bugly干货分享】HTML 5 视频直播一站式扫盲
查看>>
https原理通俗了解
查看>>
iOS开发debug集锦
查看>>
go-fasthttp源码分析
查看>>
RaspberryPi学习之SD卡文件修改及备份
查看>>
我的友情链接
查看>>
Java版InfluxDB工具类
查看>>
Python os/shutil/path 模块
查看>>
python学习笔记操作mongodb(九)
查看>>
[转]在A*寻路中使用二叉堆
查看>>
【Cloud Foundry 应用开发大赛】“17轻松”文章采集应用
查看>>
第七节 泛型(Generics)
查看>>
union的内存分布
查看>>