我正在使用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")
}
}
谢谢!
答案 0 :(得分:0)
[PFFile clearAllCachedDataInBackground];
答案 1 :(得分:-1)
要清除缓存,您需要使用以下功能。
[PFQuery clearAllCachedResults];