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?

2
  • You mean save on disk to load Courses next time app loaded? Or you want to store Courses while app is working? Commented Apr 23, 2010 at 17:07
  • I want to save before the app closes and I want to load the content when the app is started Commented Apr 23, 2010 at 19:24

1 Answer 1

1

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:]

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.