gpt4 book ai didi

ios - NSFileManager defaultManager 如何知道一个文件是否打开?

转载 作者:行者123 更新时间:2023-11-29 12:08:17 26 4
gpt4 key购买 nike

例如:我的文档中有一个文件名为@"CoreSimulator/Devices/.../abc.pdf"

我怎么知道这个文件曾经被打开过?

我可以使用 NSFileManager 将任何客户标签添加到文件中吗?像“lastOpenTime”

最佳答案

我认为没有办法知道上次打开/访问文件的时间。 NSFileManager 确实有一种方法可以找到上次文件被修改的时间。 NSFileManager Class Reference 提到了 -attributesOfItemAtPath:error:方法。

这个方法返回

An NSDictionary object that describes the attributes (file, directory, symlink, and so on) of the file specified by path, or nil if an error occurred. The keys in the dictionary are described in File Attribute Keys.


编辑:您可能会发现这个 answer to a duplicate question便利。它建议使用 MDItem .

关于ios - NSFileManager defaultManager 如何知道一个文件是否打开?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34291594/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com