I\'m sure I\'m missing something in a small iPhone program I\'m trying to write, but the code is simple and it compiles without any errors and so I fails to see where the er
Your studentStore
instance variable is a pointer to an NSMutableDictionary
. By default, it points to nil, meaning it doesn't point to any object. You need to set it to point to an instance of NSMutableDictionary
.
- (BOOL)addStudent:(Student *)newStudent
{
NSLog(@"adding new student");
if (studentStore == nil) {
studentStore = [[NSMutableDictionary alloc] init];
}
[studentStore setObject:newStudent forKey:newStudent.adminNo];
return YES;
}