将字典写入属性列表文件中
1 NSMutableDictionary *dict = [NSMutableDictionary dictionary]; 2 [dict setObject:@"mj" forKey:@"name"]; 3 [dict setObject:[NSNumber numberWithInt:10] forKey:@"age"]; 4 5 // 获取应用沙盒的根路径 6 NSString *home = NSHomeDirectory(); 7 NSString *documents = [home stringByAppendingPathComponent:@"Documents"]; 8 // 属性列表的默认拓展名是plist 9 NSString *path = [documents stringByAppendingPathComponent:@"dict.plist"]; 10 11 [dict writeToFile:path atomically:YES];