How to Encrypt App Preferences, NSUserDefaults in iOS Apps

Last updated July 7, 2021 by Alan Bavosa

Learn the 3 Easy Steps to Encrypt App Preferences, NSUserDefaults in iOS apps – no code or coding required.

What Are App Preferences (NSUserDefaults) in iOS apps?

In iOS app development, NSUserDefaults is an interface to the users’ defaults database, which allows an app to customize its behavior to match a user’s preferences. For example, you can allow users to specify their preferred units of measurement or media playback speed. Apps store these preferences by assigning key-value pairs to a set of parameters in a user’s defaults database, which maintain persistence across app launches.

Why Encrypt App Preferences in iOS apps?

Preferences can be any kind of text-based data that may include information about users that is highly personal, private or sensitive. For example, app preferences can be used to display a screen that contains a user’s preferred currency or type of credit card used to process transactions in an e-commerce app.  The use of app preferences is very broad and flexible, and there’s no restriction on the type of information that can be stored in preferences and retrieved by other resources. Furthermore, App Preferences are stored as plain-text data (unencrypted) by default, which makes them a valuable area for hackers to target with ease.  For this reason, it makes sense to Encrypt App Preferences iOS apps, so that this data cannot be easily accessed by attackers.

How to Encrypt App Preferences in iOS apps using Appdome

Learn how to encrypt iOS App Preferences (NSUserDefaults) quickly and easily with no code or coding.

Appdome is a no-code mobile security and development platform that enables anybody to add a wide variety of mobile app security features, SDKs, and APIs to Android and iOS apps – no code or coding required.

Using Appdome, there are no development or coding prerequisites. Customers simply upload any Android or iOS app, select their desired security features, and click “Build My App”. The Appdome technology automatically builds the required security features into the app, alongside all relevant standards, frameworks and more – all with no development at all.

Follow these 3 easy steps to Encrypt App Preferences in any iOS app

Start by adding a mobile app to your Appdome account. If you don’t have an Appdome account, click here to create an account.

  1. Under the Build tab, select Security, then enable Data at Rest Encryption
  2. Click on the toggle to enable Encrypt In-App Preferences
  3. Click Build My App

encrypt app preferences in android and ios apps

Using Appdome to Encrypt App Preferences will encrypt all specific keys under NSUserDefaults in iOS.  Using Appdome to encrypt app preferences greatly enhances the security of the app from anyone trying to gain unauthorized access to application secrets and other sensitive data stores in mobile app preferences.

The technology behind Build My App has two major elements – (1) a microservice architecture filled with 1000s of code sets needed for mobile integrations, and (2) an adaptive code generation engine that can recognize the development environment, frameworks, and methods in each app and match the app to the relevant code-sets needed encrypt in-app preferences in a mobile app in seconds.

Congratulations! When your build is complete, you will see the notice below.

 Prerequisites for Encrypting App Preferences using Appdome

In order to use Appdome’s no-code platform to encrypt in-app preferences you’ll need:

After Building Your App on Appdome

After successfully building the app,  the app needs to be signed in order to deploy it.  Optionally,  you can also brand or customize apps using Appdome. Read this KB to learn how to sign, customize, brand, and deploy apps using Appdome. 

How Do I Learn More?

Read this KB article to learn how to Encrypt Shared Preferences in Android apps.

Or check out our mobile data encryption category page, where you can find dozens of more articles and other encryption resources.

To learn more about Appdome no-code data encryption, read this article on No-code Mobile Data-at-Rest Encryption.

Request a demo at any time.

If you have any questions, please send them our way at or via the chat window on the Appdome platform.

Thank you!

Thanks for visiting Appdome! Our mission is to make mobile security easy. We hope we’re living up to the mission with your project. If you don’t already have an account, you can sign up for free.

Have a question?

Ask an expert

PaulMaking your security project a success!