That's not a problem with your implementation of NSCoding, that's actually not even a problem at all! That's the way an NSArray prints itself literally (the result of the -description
method). The fact that it does this indicates that the archiving/de-archiving process went smoothly. The array is the set of parenthesis (), and the objects within are in the format <Class : memory address>
. If you had an array of invalid objects, then your array would most likely refuse to print, or crash when the students objects were added to it.
You can take advantage of this in your MIGStudent
class and override -description
to print a friendlier format. For example:
-(NSString*)description {
return [NSString stringWithFormat:@"<%@ : %p Student named: %@ - who lives at: %@ With the ID number: %d and the phone number: %d>", NSStringFromClass(self.class), self, self.name, self.address, self.studentID, self.phoneNumber];
}
As a sidenote, initializers always call through to super. Your initWithCoder:
method will always return nil.