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
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).
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With