1

我希望通过 iOS 上的 Facebook API Graph 增加签到地点的数量。

我正在使用 Hackbook 示例,目前 UITableView 中只显示了 5 个签到位置。

以下方法有一个距离参数,但我找不到要返回的签到地点数...

/*
 * Graph API: Search query to get nearby location.
 */
- (void)apiGraphSearchPlace:(CLLocation *)location {
    [self showActivityIndicator];
    currentAPICall = kAPIGraphSearchPlace;
    NSString *centerLocation = [[NSString alloc] initWithFormat:@"%f,%f",
                                location.coordinate.latitude,
                                location.coordinate.longitude];
    HackbookAppDelegate *delegate = (HackbookAppDelegate *)[[UIApplication sharedApplication] delegate];
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   @"place",  @"type",
                                   centerLocation, @"center",
                                   @"3000",  @"distance",
                                   nil];
    [centerLocation release];
    [[delegate facebook] requestWithGraphPath:@"search" andParams:params andDelegate:self];
}

如果有人知道如何做到这一点,请告诉我。

谢谢

4

1 回答 1

1

好的,我在- (void)request:(FBRequest *)request didLoad:(id)result方法中找到了:

case kAPIGraphSearchPlace:
        {
            NSMutableArray *places = [[NSMutableArray alloc] initWithCapacity:1];
            NSArray *resultData = [result objectForKey:@"data"];
            for (NSUInteger i=0; i<[resultData count] && i < 15; i++) {
                [places addObject:[resultData objectAtIndex:i]];
            }
            // Show the places nearby in a new view controller
            APIResultsViewController *controller = [[APIResultsViewController alloc]
                                                initWithTitle:@"Check In"
                                                data:places
                                                action:@"places"];
            [self.navigationController pushViewController:controller animated:YES];
            [controller release];
            [places release];
            break;
        }
于 2012-05-22T14:13:25.743 回答