From the course: iOS Development: Security

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Hacking the UserDefaults

Hacking the UserDefaults - iOS Tutorial

From the course: iOS Development: Security

Hacking the UserDefaults

- [Instructor] If you've developed iOS apps it's likely that you used UserDefaults for storing small pieces of data. Yet you shouldn't rely on UserDefaults to persist sensitive data, like login credentials. We'll see in a moment why. We use the Pasteboard Demo app from the previous lesson. If you want to follow along with me, open the project from the exercise files folder, chapter two 02_12 begin. Now let's add a feature of saving and restoring the username and the password. I switch to the main storyboard and I'll add a button. The title should be Save Credentials. Whenever the user taps the button, the contents of the username and password field should be persisted to UserDfaults. So I bring back the assistant editor and choose the ViewController source file. With the button selected in the storyboard view, I click the Connection inspector. We'll create an Action Handler by dragging from the Touch Up Inside event to the source file. Let's call the method onSaveCredentials. I…

Contents