I'm creating my first RestKit application. I'm trying to map to_many relation to core data.
Speakers JSON
{
id: 1,
session_ids: [1,87]
},
{
id: 2,
session_ids: [2,88]
},
Mapping
sessionEntitiyMapping = [RKEntityMapping mappingForEntityForName:@"Session" inManagedObjectStore:self.managedObjectStore];
[sessionEntitiyMapping addAttributeMappingsFromDictionary:@{
@"id": @"session_id",
}];
sessionEntitiyMapping.identificationAttributes = @[ @"session_id" ];
speakerEntityMapping = [RKEntityMapping mappingForEntityForName:@"Speaker" inManagedObjectStore:self.managedObjectStore];
[speakerEntityMapping addAttributeMappingsFromDictionary:@{
@"name": @"name",
@"id": @"speaker_id",
}];
[speakerEntityMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"session_ids"
toKeyPath:@"sessions"
withMapping:sessionEntitiyMapping]];
speakerEntityMapping.identificationAttributes = @[ @"speaker_id" ];
Error
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFNumber 0x8569690> valueForUndefinedKey:]: this class is not key value coding-compliant for the key id.'