在项目中,很多的属性都是在plist文件中设置的,在开发过程中,经常会需要获取这些属性值,下面是获取plist属性值的方法
NSDictionary *bundleDic = [[NSBundle mainBundle] infoDictionary];
NSString *version = [bundleDic objectForKey:@"CFBundleVersion"];
其中, CFBundleVersion为plist文件的key。plist文件的所有键值如下:
CFBundleDevelopmentRegion,
DTPlatformName,
CFBundleVersion,
LSRequiresIPhoneOS,
CFBundleSignature,
CFBundleIdentifier,
CFBundleExecutable,
CFBundleDisplayName,
CFBundleShortVersionString,
CFBundleName,
CFBundleSupportedPlatforms,
CFBundlePackageType,
NSBundleResolvedPath,
CFBundleInfoDictionaryVersion,
UIRequiredDeviceCapabilities,
UISupportedInterfaceOrientations,
NSBundleInitialPath,
CFBundleInfoPlistURL,
CFBundleExecutablePath,
DTSDKName,
UIDeviceFamily
原文:http://blog.youkuaiyun.com/qijianli/article/details/7759659