清理项目缓存图片

获得图片下载的路径,通过NSFileManager removeItemAtPath
NSString *localPath = [NSHomeDirectory()stringByAppendingPathComponent:@"Documents"] ;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *fileArray = [fileManager contentsOfDirectoryAtPath:localPath error:nil];
for (NSString *str in fileArray) {
NSString *filePath = [localPath stringByAppendingPathComponent:str];
[fileManager removeItemAtPath:filePath error:nil];
}
删除documents目录下的所有文件

如有错误请大神指出。

posted @ 2013-07-08 17:33  小乐"  阅读(294)  评论(0编辑  收藏  举报