如何访问 iPhone 中文件的文件信息(例如创建日期、大小等)?

发布于 2025-01-06 10:09:31 字数 65 浏览 2 评论 0原文

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

How to access file info (such as date created,size etc) about a file in iphone?i need to sort certain files based on the date of creation,size etc..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

银河中√捞星星 2025-01-13 10:09:31

尝试此方法:

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

然后您可以查询[attributes fileCreationDate][attributes fileSize]。请参阅 NSFileManager.h 以了解 NSDictionaryNSFileAttributes 类别。

Try this method:

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

You can then query [attributes fileCreationDate] or [attributes fileSize]. See NSFileManager.h for the NSFileAttributes category of NSDictionary.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文