0

有谁知道我如何向包含用户纬度和经度的 Facebook Graph API 发送 GET 请求。

这是适用于 iOS 的

谢谢你的帮助。

4

1 回答 1

2

您的意思是使用 Facebook Graph Api 获取用户当前位置吗?

这是我从 Facebook (Hackbook for ios) 提供的示例应用程序中借用的示例代码链接:https ://github.com/facebook/facebook-ios-sdk/tree/master/sample/Hackbook

- (void)apiGraphSearchPlace:(CLLocation *)location {

    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",
                                   @"1000",  @"distance",
                                   nil];
    [centerLocation release];
    [[delegate facebook] requestWithGraphPath:@"search" andParams:params andDelegate:self];
}
于 2012-04-17T17:47:06.170 回答