iOS Storage Best Practice
iOS Storage Best Practice
iOS Storage Best Practice
Storage Inventory
- What is this file ?
- Why is it being stored ?
- Is it in the correct place ?
- Should this be backed up ?
iCloud Drive
- Accessible across all devices
- Cached locally
- Automatically uploaded to iCloud
- Requires file coordination
- User-visible content
- Accessible in Files app
- Support “Open in Place”
- Support “File Sharing Enabled”
- Storage Settings management
- iCloud Drive
- Documents
- Application Support
- Caches
- Temporary
Application Support Directory 📁
- Required files
- Can be hierarchical
- Persistent
- Included in iCloud and iTunes Backups
- Reported in “Documents & Data”
Caches Directory 📁
- Purgeable or transient content
- Good for downloadable storage
- Not included in backups
- Reclaimed by OS if needed
Temporary Directory 📁
- Transient files
- Remove when done
- Not included in backups
Best Practices
- Exclude files from backups
- NSURLIsExcludedFromBackupKey
- Handle restored data gracefully
- 64 bit vs 32 bit content
- Version your content - Cloud or Local ?
- Choose only one - NSURL volume capacity details
- NSURLVolumeAvailableCapacityForImportantUsageKey
- NSURLVolumeAvailableCapacityForOpportunisticUsageKey