Okay, so I've been looking everywhere trying to find out how I can save data in my app and I'm getting so confused. I've seen NSUserDefaults, SQLite, archiving, plist, and I really don't know which would be best in my case.
So basically, I want to save a list of custom objects to a file. In the app I specify some data and have it save a new custom object along with the others. Then I have a table view to show all the saved objects.
So basically I'm trying to save an NSMutableArray of custom objects.
I cannot really tell you which is the best way to do it. I am in a similar situation you are (from what I can tell) and I have decided to stick to this: Core Data Tutorial for iPhone OS.
Good luck.
Cheers,
Bob
__________________ We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.
I am also interested in being able to save an array of custom objects. Someone was talking about turning the objects into NSData but I'm not sure how that's implemented. If anyone has any suggestions I would also appreciate it.
Probably the easiest is to make your objects support the NSCoding Protocol. Once they do, you can call encodeWithCoder and initWithCoder methods of the NSArray that is holding the objects and they will get "packed" up into the file you specify.
Core Data is great if you have a lot of objects and relationships that would be best served by a database of some sort. Core Data abstracts the database into a more object oriented view of the world. But be forewarned, Core Data learning curve is steep. But the power you wield is awesome.
Good Luck,
t
__________________
Check out my apps:
Friis-It NF. Easily calculate the Noise Figure, Sensitivity, and gain of an RF receiver design.
RetireMax. Get a dose of reality about that next purchase!