Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RestKit 0.20 nested object mapping trouble using API

I'm getting the titleForHeaderInSection correctly, where its pulling the leaf.

But getting nothing for themes.

I'm guessing my mapping to themes is not working, because cellForRowForIndexPath doesn't seem to be getting called when I set breakpoints.

But obviously I'm not sure and thats why I'm looking for some guidance. Thanks!

API JSON

{
    "springs": [{
        "name": "baskets",
        "leafs": [{
            "name": "New Season",
            "abbreviation": "nb",
            "themes": [{
                "name": "Hops",
                "abbreviation": "HS",
}          

ViewController.h

@property (strong, nonatomic) NSArray *springs;
@property (strong, nonatomic) NSMutableArray *leafs;
@property (strong, nonatomic) NSMutableArray *themes;
like image 652
Realinstomp Avatar asked Apr 13 '14 02:04

Realinstomp


1 Answers

This line

  [springMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"themes" toKeyPath:@"themes" withMapping:themeMapping]];

Should be

  [leafMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"themes" toKeyPath:@"themes" withMapping:themeMapping]];

Because the theme is nested inside leaf (which is itself nested inside spring).

like image 135
Wain Avatar answered Sep 29 '22 22:09

Wain