MASTG-KNOW-0093: UserDefaults
The UserDefaults
class, part of the Preferences
API, provides a programmatic interface for storing key-value pairs across app launches. It stores data in a plist file within the app sandbox and is intended for small, non-sensitive data.
UserDefaults
supports common types like NSData
, NSString
, NSNumber
, NSDate
, and NSArray
. Other types must be converted to NSData
.
Data is stored locally and included in device backups, except on managed educational devices.