エラーがあります:
[2194:c07] CoreData: error: Failed to call designated initializer on NSManagedObject class 'Event'
2012-12-08 12:00:57.505 eventCost[2194:c07] -[Event setType:]: unrecognized selector sent to instance 0x7456dd0
2012-12-08 12:00:57.523 eventCost[2194:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Event setType:]: unrecognized selector
addEventController:@protocolにプロトコルがあります
AddEventControllerDelegate
- (void) addEventControllerDidSave:(NSString *) typeText;
- (void) addEventControllerDidCancel:(Event *) personToDelete;
@end
プロトコルの実装:
- (void) addEventControllerDidCancel:(Event *)EventToDelete{
[[self currentPerson] removeEventsObject:EventToDelete];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void) addEventControllerDidSave:(NSString *)typeText{
Event *newEvent = [[Event alloc]init];
[newEvent setType:typeText];
[currentPerson addEventsObject:newEvent];
[self dismissViewControllerAnimated:YES completion:nil];
}
また、私は新しいイベントを追加するためのこのセグエを持っています:
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([[segue identifier]isEqualToString:@"addEvent"])
{
AddEventController *aec = (AddEventController *) [segue destinationViewController];
aec.delegate = self;
}
}
typeプロパティを使用して新しいイベントを追加しようとしましたが、このエラーが発生し、何が問題なのかわかりません。