I have a Save method that is supposed to save information entered in the text fields of a view controller. The method properly saves this info inside the Class variables, but I want to save the object in an array. When I try to do this , I get an error:
Use of undeclared identifier 'homeworkAssignment'; did you mean '_homeworkAssignment'?
Here is the save method
- (IBAction)Save:(UIButton *)sender {
self.homeworkAssignment = [[Homework alloc] init];
self.homeworkAssignment.className = self.ClassNameField.text;
self.homeworkAssignment.assignmentTitle = self.AssignmentTitleField.text;
self.homeworkAssignment.assignmentDiscription = self.DiscriptionTextView.text;
self.homeworkAssignment.pickerDate = self.DatePicker.date;
NSArray *MyHomeworkArray = [[NSArray alloc]initWithObjects:homeworkAssignment, nil];
//Error here ^
}
Can anyone tell me why I am able to set the homeworkAssignment object variables but get an error when trying to store the object in the array?
self.means? Can you see the difference in how you are usinghomeworkAssignmenton the lines which work and the one that doesn't?