software-engineering



NSUserDefaults Best Practices

NSUserDefaults NSUserDefaults is Apple’s way to store user preferences for iOS (it’s for OSX as well but I don’t do OSX Development so I can’t talk at length about that). The data is namespaced into your own persistent domain (usually the name of your app) and cannot be accessed by others apps in iOS as it is sandboxed. Most people use NSUserDefaults for storing data between sessions. Anything that you would want to persist between sessions such as: a user’s preference for the number of items to display, whether or not somebody has seen a hint about how to use a feature, etc. I’m sure other people utilize NSUserDefaults in more creative and elaborate ways but that is my primary purpose. I’ve never actually found a good guide on how to use it and best practices with it so I figured I would write one up. This is mostly my ...(Read More)