Core Data => Adding a related object always nil

Posted by mongeta on Stack Overflow See other posts from Stack Overflow or by mongeta
Published on 2010-03-18T17:14:44Z Indexed on 2010/03/18 18:21 UTC
Read the original article Hit count: 314

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data