Reputation: 14304
Currently, I'm developing an app that functionality heavily relies upon retrieved JSON data. Most of the data I'm planning to save into core data. However, not sure do I have to save all user related stuff (settings, favorites, twitter, Facebook and ect.) also in core data, or should I use NSUserDefaults? What are pros and cons?
Upvotes: 9
Views: 2289
Reputation: 12405
You can refer to Apple's own guide: Implementing Application Preferences
you can store the user setting in any way as you want :The choice between NSUserDefaults and Core Data is just between API, where the former was actually designed to handle user preferences.
NSUserDefaults and the "built-in settings component" are really one and the same. Using the settings app will still store preferences in NSUserDefaults which you access in your app with that API.
The reason why you might not want to use the built-in settings app would be: It's cumbersome for users to change those settings. If you have settings that users might want to change frequently, you might want to do that inside your app (e.g. turning music on/off, changing player name). Also, since you have full control over your own app, you can have a more flexible GUI than the one Apple provides in Settings.app
As for using Core Data or NSUserDefaults... i would say go with NSUserDefaults as it is much easier to implement and was designed to do this, where as implementing core data will take a lot of effort.
Upvotes: 10