我正在使用 Parse 和 PFFile 开发提供音频内容的 iOS 应用。
当我从云端下载新的 mp3 文件时,数据看起来是作为缓存保存在本地。 缓存本身很好。
但我的问题是因为每个音频内容大约 3mb,而且我的应用程序的存储使用量不断增加。 我想手动删除旧的本地缓存。
这可能吗?以及如何删除缓存的文件?
[更新]
这是我的代码。 基本上我使用 getDataInBackgroundWithBlock 从解析云下载 mp3 数据。
// lessonObj is PFObject
let lessonFile = lessonObj["mp3"] as PFFile
lessonFile.getDataInBackgroundWithBlock {
(mp3Data: NSData!, error: NSError!) -> Void in
if ( error == nil ) {
// next step
} else {
// println("error")
}
}
谢谢!
最佳答案
[PFFile clearAllCachedDataInBackground];
关于ios - 如何删除PFFile的缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26389681/