Deciding to use Core Data or NSUserDefaults

core-data, ios, nsuserdefaults, objective-c

Solution

`NSUserDefaults` is really meant for storing small pieces of data such as settings, preferences, and individual values.

You should use Core Data to store a large list of elements. As far your last question, there is nothing preventing you from using both Core Data and a backend to store your data. In fact, there are frameworks out there to facilitate exactly this. Take a look at RestKit.

Problem

I have a feature on my app that allows users to invite their friends (via facebook, or friends in their address book). Most people will have < 5K friends with some people having more (maybe a max of like 10K friends?). I want to keep track of the friends they have invited so they do not re-invite them. To accomplish this I am saving a dict of friends in `NSUserDefaults` to store this information. I am wondering if `NSUserDefaults` will suffice for this, or if I need to use `Core Data`. Also, I am planning on adding a feature to allow them to invite friends to a particular event. (there are many events on our app.) If I want to keep track of which friends have been invited to which event, should I be using `Core Data` then? Will `NSUserDefaults` suffice for that? (I am assuming it won't). And lastly, should `Core Data` be used for that or should that be saved server side?

Original source