0

I have an entity called Card that has it's properties. The other entity is a Slide entity. And it has a one-to-one relation to Card. There is no mention of Slide in the JSON that i receive for Card, but in the JSON for a Slide there is a "cardID" value that is equal to ID of the Card entity.

Here is the Card mapping:

@"cardID"             : @"cardId",
@"cardTexts"          : @"texts",

And a Slide mapping:

@"imageID"   : @"imageId",
@"cardID"    : @"cardId",

And that is JSON for Slide entities:

[
    {"imageID":1619,"cardID":4922},
    {"imageID":1619,"cardID":1332}, 
    etc
]

I don't understand how to make a proper relation. Tried to make something like:

[slideMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"cardId" toKeyPath:@"card" withMapping: cardMapping]];

But it doesn't seem to work. Please point out my mistake

Thorax
  • 2,352
  • 1
  • 22
  • 27
  • possible duplicate of [Foreign key relationship mapping with RestKit](http://stackoverflow.com/questions/17326087/foreign-key-relationship-mapping-with-restkit) – Wain Jun 02 '14 at 19:03
  • You need to use foreign key mapping. The type of relationship you're using is for nested data mapping. – Wain Jun 02 '14 at 19:04

0 Answers0