I want to save a Goal and an Actor. The two entities are related with an Responsibility-relationship:
Goal *addgoal = (Goal*)[NSEntityDescription insertNewObjectForEntityForName:@"Goal" inManagedObjectContext:context];
addgoal.goalNaam = nameTextField.text;
addgoal.goalId = idField.text;
addgoal.goalBeschrijving = beschrijvingField.text;
Actor *addactor = (Actor*)[NSEntityDescription insertNewObjectForEntityForName:@"Actor" inManagedObjectContext:context];
addactor.actorNaam = responsibleField.text;
[addgoal addResponsibilityObject:addactor];
the line above ([addgoal addResponsibility:addactor]) is causing the error, what is wrong ?
in Goal.h:
@interface Goal (CoreDataGeneratedAccessors)
- (void)addResponsibilityObject:(Actor *)value;
@end
Error:
2012-08-02 20:57:11.838 Choose3[7434:fb03] -[__NSCFSet entity]: unrecognized selector sent to instance 0x8877810 2012-08-02 20:57:11.840 Choose3[7434:fb03] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFSet entity]: unrecognized selector sent to instance 0x8877810'
entity
but you're calling it on the wrong type of object. – Phillip Mills- (void)addResponsibilityObject:(Actor *)value;
– Jeff Wolskientity
; it exists for a number of different classes related to Core Data. The error message is claiming thatentity
is being called on a NSSet, which is not one of the classes that has it. Is "Responsibility" a too-many relationship...it's almost as if Core Data is confused about that? – Phillip Mills