iOS中的NSCachesDirectory和NSDownloadsDirectory有什么区别? [英] what's the difference between NSCachesDirectory and NSDownloadsDirectory in iOS?

查看:901
本文介绍了iOS中的NSCachesDirectory和NSDownloadsDirectory有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将下载的杂志保存到我的iOS应用中的一个目录中。似乎 NSCachesDirectory NSDownloadsDirectory 是合适的。我不知道它们之间的区别,哪一个适合下载杂志。任何建议都表示赞赏。

I want to save downloaded magazines to one directory in my iOS app. It seems NSCachesDirectory and NSDownloadsDirectory are suitable. I don't know the difference between them and which one is suitable for downloading magazines. Any suggestions are appreciated.

推荐答案

在内存不足的情况下可以删除NSCachesDirectory

NSCachesDirectory can be deleted in cases of low memory

如果您不希望删除文件,则必须将它们存储在Documents目录中,但如果您不希望iTunes,iCloud等支持您的文件,请添加不备份。

If you don't want your files to be deleted you have to store them in the Documents directory, but add "do not backup" if you don't want your files to be backed by iTunes, iCloud etc..

请查看苹果的文件系统编程指南文件系统基础知识

这篇关于iOS中的NSCachesDirectory和NSDownloadsDirectory有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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