I will be storing a few strings (maybe 10-20). I am not sure if I should use NSUserDefaults to save them, or write them out to a plist. What is considered best practice? NSUserDefaults seems like it is less lines of code, therefore quicker to implement.
I'd like to add that these string values will be added/removed by the user.
Best Answer
I am assuming an array, but it will work with dictionaries too.
Userdefaults, Core Data and Plists can all be read/write but if you use a plist you need to pay attention in what dir you put it. See the plist part down below.
Core Data I think it's way too much overkill, it's just strings. It's supposed to be used when you want to persist more complex objects.
NSUserDefaults:
It's pretty fast and easy to do, though it's supposed to store only user settings. To write them to the userdefaults:
To read the from the userdefaults:
Plist:
If your strings are going to be modified you will need to write and read a plist but you cant't write into your app's resources.
To have a read/write plist first find the documents directory
Create the array (I am assuming the strings are string1, ...)
Write it to file
To read the plist:
Find the documents directory
Read it in: