iPhone storage in tmp directory
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).
When does iOS clean the local app ./tmp directories?
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.
Related Topics
Swift 3 - How to Make Timer Work in Background
An Elegant Way to Ignore Any Errors Thrown by a Method
Pass in a Type to a Generic Swift Extension, or Ideally Infer It
Present a Modal View Controller with Transparent Background
Region Monitoring Glitch on iOS 7 - Multiple Notifications at the Same Time
Uiimagejpegrepresentation Received Memory Warning
Order Two Nsmutablearrays Based on One
Error: "Array Index Out of Range" in Multidimensional Array
Audiokit: Using the New Aksequencer with Any Variety of the Callback Instruments
Open Links in Safari Instead of Uiwebview
Xcode 4.3.2, Issue with Running on Simulator
How to Do Indexofobject or a Proper Containsobject
iPhone Storage in Tmp Directory
Is It Ok to Place Most Logic and Models in the Appdelegate
How to Display the Emoji and Special Characters in Uilabel and Uitextviews
Swift - Tableview Row Height Updates Only After Scrolling or Toggle Expand/Collapse