IOS获取plist文件属性值的方法

来源:互联网 发布:mysql error 1044 编辑:程序博客网 时间:2024/05/22 00:10

在项目中,很多的属性都是在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

0 0