iOS从info.plist 获取项目的…

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

http://danal.blog.51cto.com/3353275/655317

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值