well i am storing An id of a student into a NSMUtableArray what i am trying is that to expand that array to accept two field rather than just the student id
[[NSUserDefaults standardUserDefaults] synchronize]; NSArray *archivedArray = [NSKeyedUnarchiver unarchiveObjectWithFile:[self dataFilePath]]; if (archivedArray == nil) { data = [[NSMutableArray alloc] init]; } else { data = [[NSMutableArray alloc] initWithArray:archivedArray]; }
As you can see the data variable is only expecting one field
If I understand your question correctly, you want to have two (or more, later) fields for each “record” in the array.
One common way to do that could be to create a dictionary with the fields you need, then add the dictionaries to the array:
Feel free to add more fields to the student record, and more students to the array. The id field of the dictionary maybe shouldn’t be a string, either, but that’ll do for a start.