何时删除 NSCachesDirectory 中的文件? [英] When are files from NSCachesDirectory removed?

查看:32
本文介绍了何时删除 NSCachesDirectory 中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS NSCachesDirectory 中的文件在什么情况下会被删除?显然,删除并重新安装应用程序.应用升级呢?磁盘空间不足情况如何?还有什么?

In what circumstances would files in the iOS NSCachesDirectory get removed? Obviously, delete and reinstall an application. What about application upgrade? What about low disk space conditions? Anything else?

推荐答案

我们的经验是此文件夹会在应用更新时被清除.很高兴知道该文件夹何时可以被清除.文档将此文件夹描述为

Our experience is that this folder gets cleared on app updates. It would be nice to know when exactly this folder is a candidate for being cleared. The docs describe this folder as

可丢弃缓存文件的位置(库/缓存)

location of discardable cache files (Library/Caches)

NSDocumentDirectory 不会在应用更新时被清除,但要小心使用这个文件夹,因为 iOS 5 现在使用这个文件夹在 iCloud 中备份,如果你使用这个目录来备份你的应用程序可能会被拒绝存储除用户生成内容之外的任何内容.

The NSDocumentDirectory will not be cleared on app updates but be careful using this folder since iOS 5 now uses this folder for backing up in iCloud and your app will likely be rejected if you use this directory to store anything other then user generated content.

这篇关于何时删除 NSCachesDirectory 中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆