Storing data on device.
WHAT OPTIONS EXIST
Simple preference storage, for small values Files in the application's directories A local database, through the platform's persistence framework or a third-party one The keychain, for sensitive values
WHAT TO USE FOR SETTINGS
The preference store, for small non-sensitive values only.
WHY NOT SENSITIVE
It is not encrypted and is included in backups.
WHAT TO USE FOR CREDENTIALS AND TOKENS
The keychain, always.
WHAT IT PROVIDES
Encrypted storage, with access controlled by device unlock and optionally biometrics.
WHAT TO USE FOR STRUCTURED DATA
The platform's persistence framework, or a lightweight database.
WHAT TO PLAN FOR
Migrations between versions.
WHY
Users upgrade with existing data, and an unhandled model change loses it or crashes.
WHAT TO TEST
Upgrading from the previously released version with real data.
WHAT TO CONSIDER ABOUT BACKUPS
Which files are included, and whether they should be.
WHAT TO EXCLUDE
Large regenerable caches.
WHY
They consume the user's backup storage for nothing.
WHAT FILE PROTECTION PROVIDES
Encryption tied to device unlock state.