读取plist(helloword-info.plist)/strings文件

             

 //读取plist       

supporting Files:helloword-info.plist文件 

         NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"" ofType:@"plist"];
         NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
         NSLog(@"ddd\n%@", data);//直接打印数据。

  打印结果如下:

2013-06-14 15:44:23.561 helloword[453:c07]
{
    CFBundleDevelopmentRegion = en;
    CFBundleDisplayName = helloword;
    CFBundleExecutable = helloword;
    CFBundleIdentifier = "jd.helloword";
    CFBundleInfoDictionaryVersion = "6.0";
    CFBundleName = helloword;
    CFBundlePackageType = APPL;
    CFBundleShortVersionString = "1.0";
    CFBundleSignature = "????";
    CFBundleSupportedPlatforms =     (
        iPhoneSimulator
    );
    CFBundleVersion = "1.0";
    DTPlatformName = iphonesimulator;
    DTSDKName = "iphonesimulator6.1";
    LSApplicationCategoryType = "";
    LSRequiresIPhoneOS = 1;
    UIDeviceFamily =     (
        1
    );
    UIMainStoryboardFile = MainStoryboard;
    UIRequiredDeviceCapabilities =     (
        armv7
    );
    UISupportedInterfaceOrientations =     (
        UIInterfaceOrientationPortrait,
        UIInterfaceOrientationLandscapeLeft,
        UIInterfaceOrientationLandscapeRight
    );
}

 //读取InfoPlist.strings文件        

   NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"" ofType:@"strings"];
    NSLog(@"文件路径:%@",plistPath);
    NSString *myFileContent=[NSString stringWithContentsOfFile:plistPath encoding:NSUTF8StringEncoding error:nil];
   NSLog(@"文件内容如下:\n%@", myFileContent);//直接打印数据。

原文件的内容是:

 dddddddppp

打印结果如下:

2013-06-14 16:02:16.031 helloword[693:c07] 文件路径:/Users/qing/Library/Application Support/iPhone Simulator/6.1/Applications/A3EEDA4B-0F5E-49E5-91D8-FBCCD388B539/helloword.app/en.lproj/InfoPlist.strings

2013-06-14 16:02:16.035 helloword[693:c07] 文件内容如下:
bplist00Zdddddddppp

      

猜你喜欢

转载自higher141125.iteye.com/blog/1886824
今日推荐