What is the iOS app sandbox container structure, and which subdirectory is most appropriate for storing user-generated documents that should survive an app update?
- A.A) tmp/ - temporary files cleared by the OS between launches
- B.B) Library/Caches/ - the OS may purge this under storage pressure
- C.C) Documents/ - persists across updates and is included in backups
- D.D) Library/Application Support/ - persists across updates but is excluded from backups by default
Why C is correct
The iOS sandbox has: Documents/ (user-generated content, backed up, persists across updates), Library/Caches/ (re-creatable data, may be purged by OS, not backed up), Library/Application Support/ (app-generated data not user-visible, backed up), and tmp/ (temporary files, cleared by OS, not backed up). For user documents that must survive updates and backups, Documents/ is correct. Option A is wrong; tmp/ is not backed up and is cleared. Option B is wrong; Caches is subject to OS eviction. Option D is wrong because the question asks about user-generated documents - Library/Application Support/ is appropriate for app-generated internal data but not user documents.
Know someone studying for Mobile Security Fundamentals? Send them this one.