iPhone storage in tmp directory

vodkhang picture vodkhang · Aug 29, 2010 · Viewed 15k times · Source

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

Answer

Marcus S. Zarra picture Marcus S. Zarra · Aug 29, 2010

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).