MAC osx下的plist文件读写

   NSString *path2 = [[NSBundle mainBundle] pathForResource:@"xmlPlist" ofType:@"plist"];

    NSMutableDictionary *dic2 = [[NSMutableDictionary alloc] initWithContentsOfFile:path2];

//    NSMutableDictionary *dic3 = [dic2 copy];

    NSLog(@"dic2-%@",dic2);

    

    [dic2 setObject:@"8" forKey:@"key2"];

    

   

    

    [dic2 writeToFile:path2 atomically:YES];

    

    NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile:path2];

    NSLog(@"data =%@",data);

    

//    NSDictionary *dic3 = [NSDictionary dictionaryWithObjectsAndKeys:@"3",@"key3", nil];

//    [dic3 writeToFile:path2 atomically:YES];

    

//    NSString *path2 = [[NSBundle mainBundle] pathForResource:@"xmlPlist" ofType:@"plist"];

//    NSDictionary *dic2 = [[NSDictionary alloc] initWithContentsOfFile:path2];

    NSLog(@"dic3--%@",dic2);

你可能感兴趣的:(MAC osx下的plist文件读写)