Saving a MutableArray into a txt-file / Loading txt-file back into MutableArray
===

I had a look around, trying to find a straightforward method for first saving a MutableArray (which will contain different text arrays from UITextViews with returns etc.) into a txt-file and then loading the txt-file back into my MutableArray.

I didn't manage to come up with the reverse method (loading the text-file) and was wondering how I should go about this. I'm sure txt files and mutable arrays are not really compatible, especially if I want the MutableArray to hold various text strings from UITextViews.

Is there a way to mark the beginning of one section in a mutable array and the beginning of the next in a txt file? The aim would be to be able to edit the txt file both in the program and in a simple text editor without messing up the structure of the mutable array.

Can I use a certain special character (not \n obviously) in my txt file so as to separate different objects? 

Here is what I've come up with so far. Sorry, I'm a beginner and it's very basic. The first problem is that I get the error message 'NSMutableArray' may not respond to '-writeToFile:atomically:encoding:error:'. Next, I have no idea how to load the txt back into my Array. Finally, I'd like to come up with a way to separate the arrays in the txt so that it remains editable, but that would be the absolute icing. Perhaps a solution would be to save each Object in an Array in a separate txt file and then load each txt into the array?

    // GENERATE ARRAY
	
	NoteBook = [[NSMutableArray alloc] init];
	
	for (int temp = 0; temp < 3; temp++) {
		[NoteBook insertObject:@"Title\n\n Line1\nLine2..." atIndex:temp];
	}
	
	// SAVING MY MUTABLE ARRAY
	
	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
	NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents directory
	
	NSError *error;
	BOOL succeed = [NoteBook writeToFile:[documentsDirectory stringByAppendingPathComponent:@"myfile.txt"]
							  atomically:YES encoding:NSUTF8StringEncoding error:&error];
	if (!succeed){
		// Handle error here
	}
	
	

    // LOADING TEXTFILE AND PUT IT INTO A MUTABLE ARRAY
    // NO IDEA... how to do this

	
	
	

