Reputation: 452
I need to take existing classes for an iPhone application and store them in a preference/plist/some other data storage format. A good comparison of what I need to store is a gradebook, with the following class structure:
GBGradebook + NSArray (GBAssignment) + NSArray (GBClasses) + NSArray (GBStudent)
GBStudent + NSString *studentName ...
GBAssignment + GBGrade *grade ...
GBGrade + NSNumber *pointsReceived + NSNumber *maxPoints ...
That's the basic class structure. What is the best way to store this data?
Upvotes: 0
Views: 454
Reputation: 96937
Core Data is your best bet. There's a bit of a learning curve, but it is designed to address your storage question as well as provide other benefits, such as SQL-like querying.
Upvotes: 0
Reputation: 39376
I'm not an expert at it, but Core Data may also be an option. There is also SQLLitePersistentObjects.
Upvotes: 1
Reputation: 243146
Here's a tutorial on how to do exactly that using the NSCoding
protocol and NSKeyedArchiver
(and its counterpart, NSKeyedUnarchiver
): http://cocoaheads.byu.edu/wiki/nscoding
Basically you implement two methods and you're done.
Upvotes: 8