Skip to content

Commit

Permalink
Fix Hackbook graph api usage
Browse files Browse the repository at this point in the history
Summary:
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: https://phabricator.fb.com/D582510
  • Loading branch information
gregschechter committed Sep 24, 2012
1 parent 3eb1a97 commit b39c074
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion samples/Hackbook/Hackbook/APIResultsViewController.m
Expand Up @@ -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;
Expand Down

0 comments on commit b39c074

Please sign in to comment.