0
votes

So i'm following the ios tutorial here

http://developer.apple.com/library/ios/documentation/iPhone/Conceptual/SecondiOSAppTutorial/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011318-CH1-SW1

The data for the tableview is a custom class containing just strings and dates.

Here is what it looks like

http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/SecondiOSAppTutorial/DesigningDataModel/DesigningDataModel.html

Can anyone suggest how to save this to data between launches of the app?

3
Take a look at NSCoding.Josiah
I did consider NSCoding but as the custom class only contains strings and dates, isnt this overkill?totalitarian
No. I would say not. It's quite easy to use, and for such simple data seems to be the best choice. You could also practice Core Data.Josiah

3 Answers

1
votes

What about making the app Document based .. i.e. using UIDocument?

0
votes

You could use NSCoding to store such simple data. You could probably even use NSUserDefaults but I wouldn't recommend it. Core Data is really the way to go unless you know you'll never need anything slightly more complex.

Check out this guide on how to persist simple data using NSCoding from www.raywenderlich.com - a really good tutorial site for people beginning iOS development.

0
votes

You could use NSCoding or NSUserDefaults.

But for any real application that has a lot more than sample data you'll be looking at something like Core Data eventually.

From your comments I see that you think it's overkill for just a couple of fields. However, this is an ideal time to learn about and practice setting up a Core Data model and connecting it to a table view with a Fetched results controller.