IOS app takes up too much disk space

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.