1

如何访问有关 iphone 中文件的文件信息(如创建日期、大小等)?我需要根据创建日期、大小等对某些文件进行排序。

4

1 回答 1

5

试试这个方法:

NSError *error;
NSDictionary* attributes = [[NSFileManager defaultManager] 
                             attributesOfItemAtPath: filePath 
                                              error: &error];

然后您可以查询[attributes fileCreationDate][attributes fileSize]。参见 NSFileManager.h 的NSFileAttributes类别NSDictionary

于 2012-02-18T07:54:30.497 回答