views:

207

answers:

1

I have a custom class that is used as a wrapper to an NSMutableArray

@interface AllCourses : NSObject {

 NSMutableArray *arrClasses;
}

The array above stores Objects of another custom class.

@interface Course : NSObject {

NSString *className;
NSString *classGrade;
NSInteger creditHours;
}

I use the method below to add Course objects to my AllCourses

//Adds a new Course to the total Courses
-(void) addClass:(Course *)aCourse{
  [arrClasses addObject:aCourse];
 }

What's going to be the best way to save the arrClasses MutableArray in AllCourses so that when my app loads it can keep the saved data the user already entered and populate it?

A: 

I want to save before the app closes and I want to load the content when the app is started

The easiest way, I think, is to use -[NSArray writeToFile: automatically:] and -[NSArray initWithContentsOfFile:]

kovpas