将数组存放到文件中

NSArray * array1=[NSArray arrayWithObjects:@"wtw",@"wtm",nil];

[array1 writeToFile:@"/wtqwtq.txt" atomically:YES];

NSArray *get =[NSArray arrayWithContentsOfFile:@"/wtqwtq.txt"];

NSLog(@"%@",get);

 

将字典存放到文件中

NSMutableDictionary  *md;

md = [NSMutableDictionary dictionary];

[md setObject:[@"hello" lengthOfString] forKey:@"hello"];

[md setObject:[@"wangtianqiao" lengthOfString] forKey:@"wangtianqiao"];

 

 [md writeToFile:@"/wtqwtq.txt" atomically:YES];

NSMutableDictionary *get =[NSMutableDictionary dictionaryWithContentsOfFile:@"/wtqwtq.txt"];

NSLog(@"%@",get);

相关文章:

  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2021-08-16
  • 2021-12-02
  • 2021-09-20
  • 2021-09-21
猜你喜欢
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
相关资源
相似解决方案