Problem: As the app continues to run, it finds that the disk space is getting bigger
Analysis: Should be a cache in the network download, including the use of sdwebimage generated, and download a single file is canceled after the cache
Verify: View the TMP in the app directory (where the system holds the cache of files not downloaded), cache (where Sdwebimage caches)
For example, the download file cache has 374M; For example, Sdwebimagecache has 20M
Finally, the method of detecting file size is attached.
- (float) Foldersizeatpath: (nsstring*) folderpath{Nsfilemanager* Manager =[Nsfilemanager Defaultmanager]; if(! [Manager Fileexistsatpath:folderpath])return 0; Nsenumerator*childfilesenumerator =[[manager Subpathsatpath:folderpath] objectenumerator]; NSString*FileName; Long LongFoldersize =0; while(FileName = [Childfilesenumerator nextobject])! =Nil) {NSString* Fileabsolutepath =[FolderPath Stringbyappendingpathcomponent:filename]; Foldersize+=[self filesizeatpath:fileabsolutepath]; } returnfoldersize/(1024.0*1024.0);}-(NSString *) Tmppathdirectory {returnnstemporarydirectory ();}-(NSString *) cachepathdirectory {Nsarray*paths =Nssearchpathfordirectoriesindomains (Nscachesdirectory,nsuserdomainmask,yes); NSString*path = [Paths Objectatindex:0]; returnpath;}
IOS app takes up too much disk space