jjzjj

ios - 带 RESTKIT 的 ESPN iOS API

coder 2024-01-26 原文

编辑 - 我最近在 Git 上发布了一个关于如何解决这个问题的教程......下面是一个链接 https://github.com/lukejgeger/ESPN-API-Example.git

我正在使用 ESPN API,并试图用 NBA 中的所有球队填充表格 View 。我正在使用 restkit 并遇到了一些问题。

下面是一些代码

RKURL *baseURL = [RKURL URLWithBaseURLString:@"http://api.espn.com"];

RKObjectManager *objectManager = [RKObjectManager objectManagerWithBaseURL:baseURL];
objectManager.client.baseURL = baseURL;

RKObjectMapping* taskMapping = [RKObjectMapping mappingForClass:[Team class]];
[taskMapping mapKeyPath:@"name" toAttribute:@"teamName"];
[objectManager.mappingProvider setObjectMapping:taskMapping forResourcePathPattern:@"/teams"];
[objectManager loadObjectsAtResourcePath:[NSString stringWithFormat:@"/v1/sports/basketball/nba/teams?apikey=%@",kAPIKey] delegate:self];
[objectManager.mappingProvider setMapping:taskMapping forKeyPath:@"name"];

我收到响应代码 200,但我收到了错误

231 Encountered errors during mapping: Could not find an object mapping for keyPath

下面是我为团队返回的 JSON 的完整响应

{
    "sports": [
    {
        "name": "basketball",
        "id": 40,
        "leagues": [
        {
            "name": "National Basketball Assoc.",
            "abbreviation": "nba",
            "id": 46,
            "groupId": 7,
            "shortName": "NBA",
            "teams": [
            {
                "id": 1,
                "location": "Atlanta",
                "name": "Hawks",
                "abbreviation": "ATL",
                "color": "002B5C",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/1"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/1/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/1/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/atl/atlanta-hawks?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=1&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 2,
                "location": "Boston",
                "name": "Celtics",
                "abbreviation": "BOS",
                "color": "006532",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/2"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/2/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/2/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/bos/boston-celtics?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=2&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 3,
                "location": "New Orleans",
                "name": "Hornets",
                "abbreviation": "NO",
                "color": "0093B1",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/3"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/3/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/3/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/no/new-orleans-hornets?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=3&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 4,
                "location": "Chicago",
                "name": "Bulls",
                "abbreviation": "CHI",
                "color": "000000",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/4"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/4/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/4/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/chi/chicago-bulls?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=4&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 5,
                "location": "Cleveland",
                "name": "Cavaliers",
                "abbreviation": "CLE",
                "color": "061642",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/5"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/5/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/5/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/cle/cleveland-cavaliers?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=5&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 6,
                "location": "Dallas",
                "name": "Mavericks",
                "abbreviation": "DAL",
                "color": "0C479D",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/6"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/6/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/6/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/dal/dallas-mavericks?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=6&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 7,
                "location": "Denver",
                "name": "Nuggets",
                "abbreviation": "DEN",
                "color": "0860A8",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/7"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/7/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/7/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/den/denver-nuggets?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=7&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 8,
                "location": "Detroit",
                "name": "Pistons",
                "abbreviation": "DET",
                "color": "FA002C",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/8"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/8/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/8/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/det/detroit-pistons?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=8&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 9,
                "location": "Golden State",
                "name": "Warriors",
                "abbreviation": "GS",
                "color": "00275D",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/9"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/9/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/9/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/gs/golden-state-warriors?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=9&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 10,
                "location": "Houston",
                "name": "Rockets",
                "abbreviation": "HOU",
                "color": "D40026",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/10"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/10/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/10/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/hou/houston-rockets?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=10&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 11,
                "location": "Indiana",
                "name": "Pacers",
                "abbreviation": "IND",
                "color": "061642",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/11"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/11/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/11/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/ind/indiana-pacers?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=11&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 12,
                "location": "Los Angeles",
                "name": "Clippers",
                "abbreviation": "LAC",
                "color": "FA0028",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/12"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/12/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/12/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/lac/los-angeles-clippers?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=12&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 13,
                "location": "Los Angeles",
                "name": "Lakers",
                "abbreviation": "LAL",
                "color": "542582",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/13"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/13/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/13/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/lal/los-angeles-lakers?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=13&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 14,
                "location": "Miami",
                "name": "Heat",
                "abbreviation": "MIA",
                "color": "000000",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/14"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/14/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/14/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/mia/miami-heat?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=14&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 15,
                "location": "Milwaukee",
                "name": "Bucks",
                "abbreviation": "MIL",
                "color": "003813",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/15"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/15/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/15/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/mil/milwaukee-bucks?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=15&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 16,
                "location": "Minnesota",
                "name": "Timberwolves",
                "abbreviation": "MIN",
                "color": "0E3764",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/16"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/16/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/16/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/min/minnesota-timberwolves?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=16&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 17,
                "location": "Brooklyn",
                "name": "Nets",
                "abbreviation": "BKN",
                "color": "06143F",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/17"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/17/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/17/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/bkn/brooklyn-nets?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=17&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 18,
                "location": "New York",
                "name": "Knicks",
                "abbreviation": "NY",
                "color": "225EA8",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/18"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/18/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/18/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/ny/new-york-knicks?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=18&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 19,
                "location": "Orlando",
                "name": "Magic",
                "abbreviation": "ORL",
                "color": "0860A8",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/19"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/19/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/19/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/orl/orlando-magic?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=19&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 20,
                "location": "Philadelphia",
                "name": "76ers",
                "abbreviation": "PHI",
                "color": "000000",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/20"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/20/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/20/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/phi/philadelphia-76ers?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=20&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 21,
                "location": "Phoenix",
                "name": "Suns",
                "abbreviation": "PHX",
                "color": "23006A",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/21"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/21/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/21/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/phx/phoenix-suns?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=21&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 22,
                "location": "Portland",
                "name": "Trail Blazers",
                "abbreviation": "POR",
                "color": "000000",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/22"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/22/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/22/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/por/portland-trail-blazers?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=22&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 23,
                "location": "Sacramento",
                "name": "Kings",
                "abbreviation": "SAC",
                "color": "393996",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/23"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/23/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/23/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/sac/sacramento-kings?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=23&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 24,
                "location": "San Antonio",
                "name": "Spurs",
                "abbreviation": "SA",
                "color": "000000",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/24"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/24/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/24/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/sa/san-antonio-spurs?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=24&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 25,
                "location": "Oklahoma City",
                "name": "Thunder",
                "abbreviation": "OKC",
                "color": "C67C03",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/25"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/25/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/25/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/okc/oklahoma-city-thunder?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=25&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 26,
                "location": "Utah",
                "name": "Jazz",
                "abbreviation": "UTAH",
                "color": "06143F",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/26"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/26/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/26/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/utah/utah-jazz?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=26&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 27,
                "location": "Washington",
                "name": "Wizards",
                "abbreviation": "WSH",
                "color": "0E3764",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/27"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/27/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/27/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/wsh/washington-wizards?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=27&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 28,
                "location": "Toronto",
                "name": "Raptors",
                "abbreviation": "TOR",
                "color": "CE0F41",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/28"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/28/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/28/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/tor/toronto-raptors?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=28&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 29,
                "location": "Memphis",
                "name": "Grizzlies",
                "abbreviation": "MEM",
                "color": "5D76A8",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/29"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/29/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/29/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/mem/memphis-grizzlies?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=29&ex_cid=espnapi_public"
                        }
                    }
                }
            },
            {
                "id": 30,
                "location": "Charlotte",
                "name": "Bobcats",
                "abbreviation": "CHA",
                "color": "FE3310",
                "links": {
                    "api": {
                        "teams": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/30"
                        },
                        "news": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/30/news"
                        },
                        "notes": {
                            "href": "http://api.espn.com/v1/sports/basketball/nba/teams/30/news/notes"
                        }
                    },
                    "web": {
                        "teams": {
                            "href": "http://espn.go.com/nba/team/_/name/cha/charlotte-bobcats?ex_cid=espnapi_public"
                        }
                    },
                    "mobile": {
                        "teams": {
                            "href": "http://m.espn.go.com/nba/clubhouse?teamId=30&ex_cid=espnapi_public"
                        }
                    }
                }
            }]
        }]
    }],
    "resultsOffset": 0,
    "resultsLimit": 50,
    "resultsCount": 30,
    "timestamp": "2012-11-05T00:40:18Z",
    "status": "success"
}

最佳答案

你的问题在这里:

[objectManager.mappingProvider setMapping:taskMapping forKeyPath:@"name"];

由于 taskMapping 将“name”映射到“teamName”,为 keyPath“name”分配该映射将导致以下搜索:“name.name”,这显然不是您想要的。其余代码似乎是正确的,我只是删除该行,您应该没问题。

关于ios - 带 RESTKIT 的 ESPN iOS API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13224481/

有关ios - 带 RESTKIT 的 ESPN iOS API的更多相关文章

  1. ruby - 如何验证 IO.copy_stream 是否成功 - 2

    这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下

  2. Ruby 文件 IO 定界符? - 2

    我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的

  3. Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting - 2

    1.错误信息:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:requestcanceledwhilewaitingforconnection(Client.Timeoutexceededwhileawaitingheaders)或者:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:TLShandshaketimeout2.报错原因:docker使用的镜像网址默认为国外,下载容易超时,需要修改成国内镜像地址(首先阿里

  4. ruby - 为什么不能使用类IO的实例方法noecho? - 2

    print"Enteryourpassword:"pass=STDIN.noecho(&:gets)puts"Yourpasswordis#{pass}!"输出:Enteryourpassword:input.rb:2:in`':undefinedmethod`noecho'for#>(NoMethodError) 最佳答案 一开始require'io/console'后来的Ruby1.9.3 关于ruby-为什么不能使用类IO的实例方法noecho?,我们在StackOverflow上

  5. ruby - 为 IO::popen 拯救 "command not found" - 2

    当我将IO::popen与不存在的命令一起使用时,我在屏幕上打印了一条错误消息:irb>IO.popen"fakefake"#=>#irb>(irb):1:commandnotfound:fakefake有什么方法可以捕获此错误,以便我可以在脚本中进行检查? 最佳答案 是:升级到ruby​​1.9。如果您在1.9中运行它,则会引发Errno::ENOENT,您将能够拯救它。(编辑)这是在1.8中的一种hackish方式:error=IO.pipe$stderr.reopenerror[1]pipe=IO.popen'qwe'#

  6. ruby - IO::EAGAINWaitReadable:资源暂时不可用 - 读取会阻塞 - 2

    当我尝试使用“套接字”库中的方法“read_nonblock”时出现以下错误IO::EAGAINWaitReadable:Resourcetemporarilyunavailable-readwouldblock但是当我通过终端上的IRB尝试时它工作正常如何让它读取缓冲区? 最佳答案 IgetthefollowingerrorwhenItrytousethemethod"read_nonblock"fromthe"socket"library当缓冲区中的数据未准备好时,这是预期的行为。由于异常IO::EAGAINWaitReadab

  7. ruby - 如何使用 ruby​​ fibers 避免阻塞 IO - 2

    我需要将目录中的一堆文件上传到S3。由于上传所需的90%以上的时间都花在了等待http请求完成上,所以我想以某种方式同时执行其中的几个。Fibers能帮我解决这个问题吗?它们被描述为解决此类问题的一种方法,但我想不出在http调用阻塞时我可以做任何工作的任何方法。有什么方法可以在没有线程的情况下解决这个问题? 最佳答案 我没有使用1.9中的纤程,但是1.8.6中的常规线程可以解决这个问题。尝试使用队列http://ruby-doc.org/stdlib/libdoc/thread/rdoc/classes/Queue.html查看文

  8. ruby - 如何从 ruby​​ 中的 IO 对象获取文件名 - 2

    在ruby中...我有一个由外部进程创建的IO对象,我需要从中获取文件名。然而我似乎只能得到文件描述符(3),这对我来说不是很有用。有没有办法从此对象获取文件名甚至获取文件对象?我正在从通知程序中获取IO对象。所以这也可能是获取文件路径的一种方式? 最佳答案 关于howtogetathefilenameinC也有类似的问题,我将在这里以ruby​​的方式给出这个问题的答案。在Linux中获取文件名假设io是您的IO对象。以下代码为您提供了文件名。File.readlink("/proc/self/fd/#{io.fileno}")例

  9. iOS快捷指令:执行Python脚本(利用iSH Shell) - 2

    文章目录前言核心逻辑配置iSH安装Python创建Python脚本配置启动文件测试效果快捷指令前言iOS快捷指令所能做的操作极为有限。假如快捷指令能运行Python程序,那么可操作空间就瞬间变大了。iSH是一款免费的iOS软件,它模拟了一个类似Linux的命令行解释器。我们将在iSH中运行Python程序,然后在快捷指令中获取Python程序的输出。核心逻辑我们用一个“获取当前日期”的Python程序作为演示(其实快捷指令中本身存在“获取当前日期”的操作,因而此需求可以不用Python,这里仅仅为了演示方便),核心代码如下。>>>importtime>>>time.strftime('%Y-%

  10. iOS适配Unity-2019 - 2

    iOS适配Unity-2019背景由于2019起,Unity的Xcode工程,更改了项目结构。Unity2018的结构:可以看Targets只有一个Unity-iPhone,Unity-iPhone直接依赖管理三方库。Unity2019以后:Targets多了一个UnityFramework,UnityFramework管理三方库,Unity-iPhone依赖于UnityFramwork。所以升级后,会有若干的问题,以下是对问题的解决方式。问题一错误描述error:exportArchive:Missingsigningidentifierat"/var/folders/fr//T/Xcode

随机推荐