Click on the button to trigger the event to add the button below!
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:%d", [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:nilwaitUntilDone:YES];});
-(void) clearcachesuccess
{
NSLog (@ "clean success");
}
http://blog.csdn.net/daiyelang/article/details/30068351 from the original
iOS cleanup cache