1,判断文件是否存在
NSFileManager *fm;
fm = [NSFileManager defaultManager];
if([fm fileExistsAtPath:strPath] == NO)
{
NSLog(@"file is not exist!");
}
2,文件中添加一项并且读取全部内容
NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile:strPath];
[data setObject:@"add some content" forKey:@"c_key"];
[data writeToFile:strPath atomically:YES];
NSMutableDictionary *data2 = [[NSMutableDictionary alloc] initWithContentsOfFile:strPath];
NSLog(@"%@",data2);