Browse files

Fix Hackbook graph api usage

Hackbook adopts the migration bundle of the SDK in general, meaning it gets updated profile picture viewer semantics, and thus receives an array rather than just a URL.

Modify the accessor to dive in and get the URL when the 'details' isn't a string.

Test Plan: Ran Hackbook

Reviewers: jacl, chrisp, clang, mmarucheck, ayden, karthiks, mingfli, caabernathy

Reviewed By: jacl

CC: msdkexp@

Differential Revision:
  • Loading branch information...
1 parent 3eb1a97 commit b39c0746d79807f38997337fb00f73bfad74c272 @gregschechter gregschechter committed Sep 24, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 samples/Hackbook/Hackbook/APIResultsViewController.m
@@ -249,7 +249,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.textLabel.numberOfLines = 2;
// If extra information available then display this.
if ([[myData objectAtIndex:indexPath.row] objectForKey:@"details"]) {
- cell.detailTextLabel.text = [[myData objectAtIndex:indexPath.row] objectForKey:@"details"];
+ id details = [[myData objectAtIndex:indexPath.row] objectForKey:@"details"];
+ if (![details isKindOfClass:[NSString class]]) {
+ // If details isn't a string, it's the return data for an image request, and we pull
+ // the url for it.
+ details = [[details objectForKey:@"data"] objectForKey:@"url"];
+ }
+ cell.detailTextLabel.text = details;
cell.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:12.0];
cell.detailTextLabel.lineBreakMode = UILineBreakModeCharacterWrap;
cell.detailTextLabel.numberOfLines = 2;

0 comments on commit b39c074

Please sign in to comment.