ios copy项目文件到Documents目录下


 

 
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];
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM