Core Data => Adding a related object always nil
- by mongeta
Hello,
I have two tables related: DataEntered and Model
DataEntered
-currentModel
Model
One DataEntered can have only ONE Model, but a Model can stay into many DataEntered.
The relationship is from DataEntered to Model (No To Many-relathionship) and no inverse relation.
XCode generates the setters for DataEnteredModel:
@property (nonatomic, retain) NSSet * current_model;
- (void)addCurrent_modelObject:(CarModel *)value;
- (void)addCurrent_model:(NSSet *)value;
I have a Table and when I select a model, I want to store it to DataEntered:
Model *model = [fetchedResultsController objectAtIndexPath:indexPath];
NSLog(@"Model %@",model.name); // ==> gives me the correct model name
[dataEntered addCurrent_modelObject:model]; // ==> always nil
[dataEntered setCurrent_model:[fetchedResultsController objectAtIndexPath:indexPath]]; // the same, always nil
what I'm doing wrong ?????
thanks,
r.