且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iPhone中应用程序的“文档”文件夹

更新时间:2022-11-04 19:49:03

这是获取文档目录的最常用方法–

This is the more commonly used approach to get the documents directory –

NSArray *searchResults = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [searchResults objectAtIndex:0];

NSString *filePath = [documentsDirectory stringByAppendingPathComponent:fileName];

您可以使用 NSFileManager 来检查目录。您可以查看 contentsOfDirectoryAtPath:error:方法。