So, let’s say we have an app that needs to remember a few simple things that the user puts in when they first load the app. It needs to remember the user’s name and birthday, to show on some view controller, or maybe even for a countdown on their Apple Watch.
There are plenty of ways to save data for your app. Some are easy to use, but rather limited, while others are much harder to use, but give you a lot more capabilities. Today, we are going to cover something on the easy, but limited end of the spectrum. For the app mentioned above, the information we’re storing will be used to set this app up with default values, for this user anyway.
That is why this method is called NSUserDefaults. It has its limitations, but it is very easy to use, and is ideal for simple storage of things like Strings and numbers.
[Read more…]