Iphone – use Core Data for the iPhone app

core-dataiphone

I'm working on my 2nd iPhone app and am curious about Core Data. Time on the project is limited, as is my time overall.

I'm the only dev and I have a feeling that Core Data would be useful but I can't clearly explain why.

Please excuse the following obfuscation .. the app needs to retrieve a list of foos from a central server. Users can then add a bar, from a list of bars, to the foos, then add a baz from a list of bazes(!?) to the bar, then add some optional photo and description to the baz.

Once the user is happy with their bar and baz work they then hit a sync button to upload their data back to the central server.

As you can see, it's a simple data driven drill down app, but I'm still not sure I can justify using Core Data with our time constraints – the learning curve looks steep.

If argue to my boss that we should be using Core Data, what bullet points can I shoot at him? Logic grenades are also appreciated.

Best Answer

Core Data will mainly help in the auxiliary facets of the application - things like data persistence, presentation, etc. Some bullet points for your boss:

  • Core Data manages save and undo functionality for you. It has a persistent store, which tracks changes, and can be flushed to the disk automatically at any number of times (app close, etc.).
  • Core Data and related classes provide easy ways to get your entities into UITableViews, like NSFetchedResultsController.
  • Core Data abstracts away a lot of the messy things you'd otherwise have to deal with yourself, such as lists of objects, one-to-many or many-to-many relationships, or constraints on object attributes, into a single nice clean object-oriented interface.
  • Core Data comes with a nice graphical object model editor that can help you think through your object/entity design, and refine it as you go. (It also supports migration, so if you decide later that you want different attributes on your entities, you can do that relatively easily.)

Sure, the learning curve may be a bit steep, but the Apple examples are great to start with, and the Core Data documentation is very complete and helpful. Once you've got Core Data down, it'll be a breeze to build your app.

Related Topic