The iOS Interview Guide by Alex Bush

The iOS Interview Guide by Alex Bush

Author:Alex Bush
Language: eng
Format: mobi
Publisher: Softcover
Published: 2018-09-11T04:38:59.475219+00:00


6.4 What is NSUserDefaults?

NSUserDefaults is one of the common tools used in virtually every application for lightweight storage. Every iOS developer should be familiar with it.

Expected Answer: NSUserDefaults is a key-value storage that can persist serialized NSCoding compliant objects and primitives. Unlike Keychain, it is not secure and does not persist between app uninstalls. It’s main purpose is to store small objects that are easily retrievable but also not important to lose.

A typical use case for it is some locally stored user preferences and/or flags. Do not use it as a database replacement because it was not built for extensive querying or for handling large amounts of data.

Red Flag: Using user defaults for data that needs to be secure is a red flag. For example, you would never want to store a user’s password or access token in user defaults; use Keychain for that instead.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.