OliverLetterer / SLRESTfulCoreData

Objc naming conventions, autogenerated accessors at runtime, URL substitutions and intelligent attribute mapping
MIT License
178 stars 13 forks source link

JSON Error #4

Closed thedevme closed 11 years ago

thedevme commented 11 years ago

I get the following errors and cant figure out why because I have tried linking it to player_id, _id and id and nothing seems to work I keep getting the same error.

Sorry for the twitter post.

WARNING: JSON Object did not have an id API return an unexpected JSON object

ManagedObject

JSON looks like: { filter: "Player", _id: "21d7e8e6a", id: "2404", first_name: "Chris", last_name: "Wilcox", track_path: "/roster/Chris-Wilcox", status: "Active", jersey: "44", position: "F-C", height: "6-10", weight: "235", birth_date: "09/3/1982", experience: "10", image: "", twitter: "@chriswilcox44", full_image: "", content_url: "http://celtics-feed-staging.herokuapp.com/nba/player_detail.html/2404/iphone/640x960/2/4.4", nick_name: "", school: "Maryland", rookie_year: "2002", country: "USA", biography: "

2011-12 SEASON: Averaged 5.4 points and 4.4 rebounds in 17.2 minutes per game...Also shot 59.8% from the floor...Averaged 11.0 points and 6.3 rebounds in his four starts while shooting 64.5% from the floor...Made his Celtic debut against the Knicks on Christmas Day and recorded four points and three rebounds in 14:03...Was injured during the game against the Heat on Dec. 27 and was diagnosed with a bruised left shoulder...Missed the Dec. 28 game against New Orleans with a bruised left shoulder...Also missed 12/30 against Detroit and 1/1 against Washington with a bruised left shoulder...Recorded 14 points and six rebounds against Indiana on Jan. 27...Recorded his first start as a Celtic against Chicago on Feb. 12 and recorded 11 points and nine rebounds...Recorded a season-high 17 points, nine boards and three assists against Detroit on Feb. 15 in his second start...Grabbed a season-high 13 rebounds against Milwaukee on Feb. 29...Was announced on Mar. 13 that he will undergo aorta surgery on Mar. 29 and miss the remainder of the 2011-12 season.

PROFESSIONAL CAREER: 2010-11: Scored 10-plus points 16 times, 20-plus points twice...Averaged 11.3 points and 6.0 rebounds in his last 15 games compared to 6.1 and 4.3 in his previous 42...Tallied a season-high 27 points and season-high 13 rebounds vs. Milwaukee (4/8)...Recorded his 200th career block vs. New Jersey (2/4)...Played in his 500th career game vs. Dallas (1/17)...Blocked a season-high 3 shots at Charlotte (12/27)...2009-10: Appeared in 34 games (10 starts) averaging 4.5 points, 3.4 rebounds and 0.4 assists in 13.0 minutes per game...In 10 starts averaged 5.4 points, 3.9 rebounds and 0.6 assists in 15.1 minutes per game...Scored 10-plus points four times and grabbed 10-plus rebounds once... Led the club in rebounds four times...Played 15-plus minutes in 12 games...Ranked second on the team in field goal percentage at 52.5 % (63-120 FG)...Scored a season-high 14 points (7-9 FG) and grabbed a season-high 10 rebounds vs. New York (1/16), his first double-double as a Piston...Tallied a season-high three steals at Charlotte (12/22)...Played a season-high 27 minutes at Chicago (1/11)...Missed 17 games during the season due to injury...Missed six games with a sore back (2/24-3/5) and 11 games with a strained left hamstring (3/26-4/14)...DNP-CD 29 times and DNP-Inactive List twice...2008-09: In 62 games with Oklahoma City and New York, averaged 7.2 points, 4.5 rebounds and shot 49.7% from the field in 16.9 minutes per game...Notched two 20-plus scoring games and three double-doubles, all with the Thunder... Scoring average (7.2) was the third-lowest of career...Averaged 8.4 points, 5.3 rebounds and shot .485 in 37 games with Oklahoma City...Scored a season-high 23 points in a season-high 36 minutes vs. Golden State (12/31)...Tallied a season-high 12 rebounds at Atlanta (12/23)... Appeared in 25 games with New York, averaging 5.4 points, 3.3 rebounds and shooting .529 from the field over 13.2 minutes per game...Had three double-figure scoring performances with New York...Notched Knicks highs of 14 points (twice) and nine rebounds (3/20 vs. Sacramento)...Logged 20-plus minutes three times with New York...2007-08: Averaged 13.4 points, 7.0 rebounds, a career-high 1.2 assists and 28.0 minutes in 62 games (55 starts)...Shot 52.4 % (334-638FG) from the field (17th in NBA)...Led or co-led the team in rebounds 19 times...Led or co-led the team in scoring 10 times...Had 10-plus rebounds 18 times...Had 17 double-doubles... Scored 20-plus points 11 times...Scored a season-high 30 points vs. Miami (2/29)...Recorded a season-high 15 rebounds twice...Missed 18 games with a dislocated right little finger. 2006-07: One of three Sonics players to play in all 82 games (Collison and Wilkins), starting 81... Averaged career highs in points (13.5), rebounds (7.7) and minutes (31.5)...Shot 52.9 percent (433-819) from the field (16th in NBA)...Averaged 7.7 rpg (T22nd in NBA)...Scored 20-plus points 18 times...Led or co-led the team in scoring eight times...Led or co-led the team in rebounds 30 times...Had 10-plus rebounds 23 times...Had 20 double-doubles...Scored a career-high 32 points to go along with 18 rebounds vs. the L.A. Lakers (4/6)...Swiped a career-high five steals at Orlando (11/8). 2005-06: Averaged 8.1 points, 5.3 rebounds and 0.7 assists in 19.9 minutes per game playing in 77 games with the Los Angeles Clippers and Seattle...Played in 29 games with the Sonics (23 starts)... Averaged 14.1 points, 8.2 rebounds and 30.1 minutes per game...Shot 59.2% (167-282 FG) from the field...Had seven double-doubles...Named Western Conference Player of the Week (4/3-9) after averaging 23.0 points and 15.3 rebounds on 75.0% shooting (27-36 FG) while leading the Sonics to a 3-0 week...Handed out a career-high six assists at Portland (4/7)...Recorded 26 points and a career-high 24 rebounds vs. Houston on 4/4 (first Sonics 20/20 game since 11/15/95 – Shawn Kemp)...Netted a career-high 30 points vs. Milwaukee (3/22)...Played in 48 games with the Clippers before being traded, averaging 4.5 points, 3.6 rebounds and 13.7 minutes while shooting 53.6% (90-168 FG) from the field. 2004-05: Averaged 7.9 points, 4.2 rebounds and 18.6 minutes in 54 games (25 starts)...Missed 13 games due to injury, including 12 games on the Injured List (1/5-28) with a right lower leg stress reaction. 2003-04: Averaged 8.6 points, 4.7 rebounds and 20.6 minutes in 65 games (17 starts)...Connected on a team-high 52.1% (227-436 FG) of his field goals...Scored 24 points (11-15 FG) and pulled down 13 rebounds at Phoenix on 4/13, including a game-winning tip-in that snapped a 13-game Clippers losing streak...Missed 16 games due to injury, 12 games with a strained left Achilles tendon and four games with a strained left groin. 2002-03: Averaged 3.7 points, 2.3 rebounds and 10.4 minutes in 46 games (three starts) as a rookie...Scored in double-figure six times...Missed five games due to back spasms.

COLLEGE: Averaged 7.9 points, 4.7 rebounds and 1.0 blocks over his two-year collegiate career...Helped Maryland reach the NCAA Final Four in each of his two seasons as a Terrapin, and helped the school win the NCAA Championship as a sophomore...Tallied 12.0 points, 7.1 rebounds, 1.5 blocks and 24.1 minutes in 36 games as a sophomore...Shot 50.4% (173-343 FG) from the field...Earned Third Team All-ACC and honorable mention ACC All-Defensive Team honors...Finished the season as the team's third-leading scorer and second-leading rebounder... In Maryland's NCAA Final Four win over Kansas, tallied 18 points, nine rebounds and four blocks in 26 minutes of play...In NCAA Championship Final victory over Indiana, recorded 10 points and seven boards in 24 minutes...Averaged 3.6 points and 2.1 rebounds in 8.6 minutes as a freshman.

PERSONAL: Full name is Chris Ray Wilcox...In addition to Enloe High School in Raleigh, also attended Whiteville High School and West Columbus High School – both located in Whiteville, N.C...Active in the Detroit community, he purchased 25 tickets to each home game giving underprivileged children the opportunity to watch a NBA game in-person...Joined Celtics' Paul Pierce and celebrities Rihanna and Kelly Rowland last season to raise public awareness for the plight of Jasmina Anema, a six-year-old Greenwich Village kindergartner suffering from a rare form of leukemia...Also while in New York, joined the rest of his Knicks teammates and a bevy of celebrities and supermodels at Knicks Bowl 10 presented by Bud Light, the star-studded charity event at Chelsea Piers that has helped raise $1.7 million for the Garden of Dreams Foundation.

", player_id: "2404", display_name: "Chris Wilcox", age: 30, player_career_stats: { assists: "0.7", blocks: "0.4", field_goal_percentage: "54.1", fouls: "2.4", free_throw_percentage: "64.3", games_played: "628", minutes_per_game: "19.9", points_per_game: "8.2", rebounds: "4.9", steals: "0.5", three_point_percentage: "0.0", turnovers: "1.1" }, player_season_stats: { season: "2012-2013", team: "BOS", statistics: { assists: "0.4", blocks: "0.5", field_goal_percentage: "71.9", fouls: "2.0", free_throw_percentage: "67.2", games_played: "61", minutes_per_game: "13.6", points_per_game: "4.2", rebounds: "3.0", steals: "0.5", three_point_percentage: "0.0", turnovers: "0.6" } } }

OliverLetterer commented 11 years ago

I can think of two possible reasons for this:

thedevme commented 11 years ago

Thank you I was fighting with that all day yesterday and I thought I tried all of the combinations but got it working.

I have one more question that I am having trouble with. I need to get to statistics but statistics doesn't actually have an id and I want to put the values into Player Season Stats Model. Is there a way to access these properties without having to create a Statistics Model object because without an ID it won't actually save. Thank you once again for your help. Example:

{ filter: "Player", _id: "21d7e8e6a", id: "2404", first_name: "Chris", last_name: "Wilcox", player_season_stats: { season: "2012-2013", team: "BOS", statistics: { assists: "0.4", blocks: "0.5", field_goal_percentage: "71.9", fouls: "2.0", free_throw_percentage: "67.2", games_played: "61", minutes_per_game: "13.6", points_per_game: "4.2", rebounds: "3.0", steals: "0.5", three_point_percentage: "0.0", turnovers: "0.6" } } }

OliverLetterer commented 11 years ago

You could either create a transformable attribute in which you parse the statistics or register a custom attribute mapping like:

[self registerAttributeMapping:@{
  @"blocks": @"statistics.blocks",
  @"fieldGoalPercentage": @"statistics.field_goal_percentage",
}];

actual key paths are supported for JSON objects.