ios - iOS 会自动清理缓存目录吗?

标签 ios swift caching file-manager

我在这个路径上保存媒体文件,我想知道 iOS 会自动清理缓存还是我必须手动清理?

让 documentsUrl = self.fileManager.urls(对于:.cachesDirectory,在:.userDomainMask)。首先!

搜索了一下,没有具体的答案。

最佳答案

如果需要,操作系统可以清除此文件夹。

Documentation

Put data cache files in the Library/Caches/ directory. Cache data can be used for any data that needs to persist longer than temporary data, but not as long as a support file. Generally speaking, the application does not require cache data to operate properly, but it can use cache data to improve performance. Examples of cache data include (but are not limited to) database cache files and transient, downloadable content. Note that the system may delete the Caches/ directory to free up disk space, so your app must be able to re-create or download these files as needed. (emphasis mine)

关于ios - iOS 会自动清理缓存目录吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54746421/

相关文章:

Mathematica 中的数据缓存

java - 我是否必须始终重新启动 Tomcat 服务器才能清除 Velocity 模板缓存?

运行时iOS Patch程序指令

ios - 如何在SCNSphere对象上应用脉冲效果?

ios - iOS 14.0 Beta 中反复调用 DispatchQueue.main.asyncAfter

image - 为什么建议将图像存储在磁盘而不是 Realm 中

ios - webViewDidFinishLoad 在加载文件之前调用 - iOS 8

ios - XCode 8.3.2 Storyboard UI 元素不会出现在模拟器中

ios - iOS-将 “objects”添加到现有应用中(越狱)

ios - 将数据从 ViewController 传递到类