NSFileManager*fileManager =[NSFileManager defaultManager];
NSError*error;
NSArray*paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString*documentsDirectory =[paths objectAtIndex:0];

NSString*txtPath =[documentsDirectory stringByAppendingPathComponent:@"txtFile.txt"];

if([fileManager fileExistsAtPath:txtPath]== NO){
   
NSString*resourcePath =[[NSBundle mainBundle] pathForResource:@"txtFile" ofType:@"txt"];
   
[fileManager copyItemAtPath:resourcePath toPath:txtPath error:&error];
}

相关文章:

  • 2022-12-23
  • 2022-01-22
  • 2021-04-09
  • 2021-06-29
  • 2022-01-21
  • 2021-12-05
  • 2022-01-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2021-10-17
相关资源
相似解决方案