iphone - iPhoneOS 会自动清除库/缓存吗?

标签 iphone performance image caching

我有一个应用程序需要缓存一些图像。

我已经阅读了一些有关缓存的文档,合乎逻辑的做法是将我的图像缓存在应用程序沙箱的 Library/Caches 目录中。

据我所知,在这里存储缓存图像的原因是:

  • iTunes 不备份资料库/缓存
  • 操作系统定期清除库/缓存

第二点是我质疑的......

  • 这是真的吗?
  • 操作系统会自动清除缓存目录吗?
  • 我是否需要自己的逻辑来检测缓存是否太大并清除最旧的项目?

最佳答案

我在文档中找到了这个:

Use this directory to write any application-specific support files that you want to persist between launches of the application. Your application is generally responsible for adding and removing these files. However, iTunes removes these files during a full restore of the device so you should be able to recreate them as needed. To access this directory, use the interfaces described in “Getting Paths to Application Directories” to get the path to the directory. In iPhone OS 2.2 and later, the contents of this directory are not backed up by iTunes.

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/FilesandNetworking/FilesandNetworking.html

关于iphone - iPhoneOS 会自动清除库/缓存吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2061655/

相关文章:

html - 将自定义图像边框添加到导航栏顶部

iphone - 使用 PJSIP 和 PJSUA 的 Peer 2 Peer 调用

ios - 使用特殊键在 NavigationController 中找到 ViewController

iphone - 有没有办法从 shouldAutorotateToInterfaceOrientation 跳过旋转动画?

performance - 向量化 MATLAB 循环

python - 查看 .npy 图像

c# - 如何在我的 DataGridViewImageColumn 中添加图像?

ios - NSCalender 返回错误的年份

javascript - 我应该预先分配一个数组还是随着我的使用而增长

Ruby - 检查 if block_given 之间有什么区别?和!block.nil?