Search code examples
ioscore-data

How to clean ios app tmp folder


I have an app that can take pictures (saving them with "Allow External Storage File" flag) and noticed that its size was growing too much. After poking around I discovered that iOS created a .LINKS folder inside the tmp directory and that every time I save a picture, it gets copied both to the Documents folder and the .LINKS folder.

When the picture is deleted, its copy inside .LINKS remains there, taking space. So

  1. How do I clear the tmp folder?
  2. Why is this .LINKS folder being used?

Thanks


Solution

  • It turns out, you don't need to delete the contents of the tmp directory. iOS will clean this up periodically (especially when space gets low). I found this article helpful: http://kmithi.blogspot.in/2012/08/ios-application-directory-structure.html

    The .LINKS folder is used by NSImage and related classes to cache images. I have an app that does a lot of image generation and that directory grows by 8MB each launch. But after downloading some movies to take up space, I saw the folders contents get cleared automatically.