清空iOS应用程序缓存
2015-03-24 22:13
169 查看
清空iOS应用程序缓存
清理缓存
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) , ^{ NSString *cachPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask, YES) objectAtIndex:0]; NSArray *files = [[NSFileManager defaultManager] subpathsAtPath:cachPath]; NSLog(@"files :%ld",[files count]); for (NSString *p in files) { NSError *error; NSString *path = [cachPath stringByAppendingPathComponent:p]; if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { [[NSFileManager defaultManager] removeItemAtPath:path error:&error]; } } [self performSelectorOnMainThread:@selector(clearCacheSuccess) withObject:nil waitUntilDone:YES]; } );
清理成功后的回调
-(void)clearCacheSuccess { NSLog(@"清理成功"); }
相关文章推荐
- iOS 获取应用程序缓存大小
- iOS开发 清空沙盒路径下的缓存数据
- Fast Image Cache – iOS 应用程序高性能图片缓存
- iOS SDWebImage 清空缓存 新方法
- iOS 清空缓存(递归计算沙盒目录大小)
- iOS 获取应用程序缓存大小
- iOS【彻底清空APP缓存】
- 关闭整个应用程序的内核模式缓存
- 在ASP.NET中清空浏览器客户端的缓存
- 导出到excel,将数字转换成三位逗号分隔的样式,清空浏览器客户端的缓存,生成缩略图
- 清空浏览器客户端的缓存
- "服务器未找到或dns错误的解决方法"之清空dns缓存法
- Enterprise Library 2.0 Hands On Lab 翻译(11):缓存应用程序块(三)
- 清空浏览器客户端的缓存
- 在ASP.NET中清空浏览器客户端的缓存
- [转]ASP.NET 缓存(十八)--从缓存中删除项时通知应用程序
- 目前大多数数据库应用程序都是基于Sql2000的,所以我们着重讲述在2000怎样实现缓存
- 清空页面缓存
- Enterprise Library 2.0 Hands On Lab 翻译(10):缓存应用程序块(二)
- Enterprise Library 2.0 Hands On Lab 翻译(11):缓存应用程序块(三)