取info.plist版本号等内容

来源:互联网 发布:破解手游用什么软件 编辑:程序博客网 时间:2024/05/17 08:52

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 listfile.

const CFStringRef kCFBundleInfoDictionaryVersionKey;
const CFStringRef kCFBundleExecutableKey;
const CFStringRef kCFBundleIdentifierKey;
const CFStringRef kCFBundleVersionKey;
const CFStringRef kCFBundleDevelopmentRegionKey;
const CFStringRef kCFBundleNameKey;
const CFStringRef kCFBundleLocalizationsKey;


Constants
kCFBundleInfoDictionaryV

ersionKey
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”), clientscan use CFBundleGetVersionNumber instead of accessing this keydirectly since that function will properly convert the versionstring 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 thelproj whose name is given by the kCFBundleDevelopmentRegionKey inthe Info.plist file. You must, therefore, ensure that a bundlecontains an lproj with that exact name containing a copy of everylocalized resource, otherwise CFBundle cannot guarantee thefallback 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 isusually localized.
Available in iOS 2.0 and later.
Declared in CFBundle.h.
kCFBundleLocalizationsKey


原创粉丝点击