Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的应用程序正在缓存内容,以便用户可以在离线时阅读它。
我将缓存的所有内容写入 iPhone 中的数据库文件(使用 CoreData)。
但是,iphone的存储大小是有限的。所以我想控制我的应用程序使用的磁盘大小。
如何检查我正在使用的磁盘大小?
谢谢
最简单和最准确的解决方案是直接检查持久存储的大小。
使用-[NSFileManager attributesOfItemAtPath:error:],然后fileSize返回字典的键。
-[NSFileManager attributesOfItemAtPath:error:]
fileSize