iOS App Sandbox Directories
Also known as: documents library tmp ios, app container dirs
Every iOS app runs inside a sandboxed data container with a fixed set of directories: Documents, Library (including Caches and Application Support), and tmp. Each has distinct backup and purge rules that determine whether files persist, get backed up to iCloud, or are deleted by the system to reclaim space.
- The three standard folders are Documents, Library (Caches, Application Support), and tmp.
- Documents and Application Support are backed up; Caches and tmp are excluded and purgeable.
- Container paths use a per-install UUID, so apps resolve them via FileManager.
The container layout
An app's writable data lives in a per-app data container isolated by the iOS sandbox, so one app cannot read another's files. The container holds three standard folders. Documents is for user-generated content that should persist and is backed up to iCloud and iTunes. Library holds app support data, and tmp holds short-lived scratch files.
Inside Library, Application Support stores files the app needs to keep but the user does not see directly, while Caches (reached via NSCachesDirectory) stores regenerable data. Apps resolve these paths through FileManager rather than hardcoding them, since the container UUID changes between installs.
Backup and purge rules
Backup and deletion behavior differ sharply by folder. Documents and Application Support are backed up and never auto-deleted, so misusing them for caches inflates a user's iCloud backup. Caches and tmp are excluded from backup, and the system may delete their contents when the device is low on storage; temporaryDirectory files can be removed even more aggressively.
Files in Caches and tmp are exactly the bytes the OS treats as purgeable, which is why a cleaner counts them as recoverable but unstable. Developers can also set the `isExcludedFromBackup` resource key to keep large regenerable files out of iCloud while still living under Documents.
Mapping storage for cleanup
Understanding this layout lets a tool reason about where an app's footprint accumulates: thumbnails, downloaded media, and offline content typically pile up in Caches, while user libraries sit in Documents. The aggregate of all apps' Caches and tmp is a large part of what Settings labels "System Data" or app cache.
Cleanor uses this model to explain what is and is not safely clearable per app: cache and temporary data can be regenerated, whereas Documents content is user-owned and should only be removed deliberately.