标签:
dispatch_async(dispatch_get_main_queue(), ^{
[SVProgressHUD showWithStatus:@"正在清理缓存" maskType:SVProgressHUDMaskTypeClear];
});
dispatch_queue_t queue = dispatch_queue_create("cleanQueue", nil);
dispatch_async(queue, ^{
NSFileManager *fileManager = [NSFileManager defaultManager];
//NSDate* begin = [NSDate date];
// __block NSError* error = nil;
//获取Books的缓存
NSArray* subFiles = [fileManager subpathsAtPath:[NSString filePathDir]];
for (NSString* fileName in subFiles)
{
if ([[NSFileManager defaultManager]fileExistsAtPath:fileName]) {
BOOL BOOL1 = [fileManager removeItemAtPath:[NSString filePathWithName:fileName] error:nil];
if (BOOL1) {
}
}
}
// 线程睡1秒 测试,实际用到是将下面代码删除即可
//[NSThread sleepForTimeInterval:1.0];
dispatch_async(dispatch_get_main_queue(), ^{
[SVProgressHUD dismiss];
});
});
}
标签:
原文地址:http://www.cnblogs.com/fdyjm/p/4894057.html