我正确地获取了titleForHeaderInSection,将其拉到leaf

但是themes一无所获。

我猜我到themes的映射不起作用,因为设置断点时似乎没有调用cellForRowForIndexPath

但是显然我不确定,这就是为什么我在寻找一些指导。谢谢!

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;

最佳答案

这条线

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

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

因为主题嵌套在叶子内(叶子本身嵌套在spring内)。

10-04 10:58