iOS article original
The code to clean up the cache is as follows:
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");
}
#define KBUNDLENAME @"Mjrefresh.bundle"
#define KSRCNAME (file) [Kbundlename Stringbyappendingpathcomponent:file]
Call:[UIImageimagenamed:ksrcname(@ "Arrow.png")];
Create a folder with suffix named bundle, picture and some resource files can be put inside
iOS development--Clean up cache