Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone storage in tmp directory

I have a question from this stackoverflow question about iPhone storage. Like I already tried to answer, we can cache data in tmp directory. But a comment says that the data can be deleted when OS whimp. I don't understand exactly the problem that the comment says.

I want to ask if the process of OS deleting tmp directory is manually or automatically. In other words, if the system auto detect that our tmp directory has to be deleted.

Another question is that if we can control, or be asked to do something (before the deleting process) that can help us to keep the tmp directory.

Another question is that if we can not do anything then how often the OS will do that, under what circumstances

like image 947
vodkhang Avatar asked Aug 29 '10 07:08

vodkhang


2 Answers

The OS will delete the temp directory on restart and at other indeterminate points. If you need to store something somewhere that you don't want backed up then use the cache directory. That will not be deleted and will not be backed up.

Your application will not be running when the temp is deleted nor will you have an opportunity to react to that deletion. This is fairly common behavior on all unix based platforms (OS X does this as well).

like image 150
Marcus S. Zarra Avatar answered Sep 30 '22 15:09

Marcus S. Zarra


In iOS 5, OS can anytime clean cache and tmp directories. Only files in documents directory won't be deleted. These files will be also backed up to iCloud, so they shouldn't be big.

Here is great article about this issue: iOS 5 caches cleaning

like image 25
Jercik Avatar answered Sep 30 '22 17:09

Jercik