When does iOS clean the local app ./tmp directories?

Ricardo Sanchez-Saez picture Ricardo Sanchez-Saez · Jul 31, 2014 · Viewed 8.4k times · Source

When does iOS clean the local app ./tmp directory?

Note that this is not a dupe of this question. I'm asking about the app specific temporary folder, not the system wide one.

You can use iExplorer to have a look at ./tmp directories on non-jailbroken phones.

(Note: I'm asking this out of curiosity only. I kind of suspect that these never get deleted unless you restore your phone from a backup or reinstall that particular app. But obviously you cannot count on that for semi-permanently storing cached files.)

Answer

neilco picture neilco · Jul 31, 2014

According to the documentation, it could be any time, if the app is not executing:

The system may also purge lingering files from this directory when your app is not running.

It's logical to assume if a) your app is not running; and b) your device is running low on storage, then it's highly likely the system will, at some point, purge the contents of <Application_Home>/tmp/.

It's also worth noting that the documentation states:

Your app should remove files from this directory when it determines they are no longer needed.

The emphasis here being on the app developer to do their own housekeeping and not leave it for the OS to tidy up after them.