我使用以下代码在Facebook iOS SDK中获取我所在位置的地点信息。
[FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"search?type=place¢er=%f,%f&distance=200&limit=100&offset=0", la, lo] completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (error) {
NSLog(@"error.localizedDescription:%@", error.localizedDescription);
}
NSArray *list = [result objectForKey:@"data"];
NSLog(@"list:%@", list);
}];
之前这些工作正常,但今天失败了。这是错误消息。
The operation couldn’t be completed. (com.facebook.sdk error 5.)
我转到facebook API页面。(http://developers.facebook.com/docs/reference/api/search/)
并且,我发现https://graph.facebook.com/search?q=coffee&type=place¢er=37.76,-122.427&distance=1000返回nil。
所以,我试着弄清楚这个问题是否是由于facebook造成的,而我唯一能做的就是等待?
答案 0 :(得分:1)
使用最新的SDK
NSMutableDictionary *params2 = [NSMutableDictionary dictionaryWithCapacity:3L];
[params2 setObject:@"37.416382,-122.152659" forKey:@"center"];
[params2 setObject:@"place" forKey:@"type"];
[params2 setObject:@"1000" forKey:@"distance"];
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"/search" parameters:params2 HTTPMethod:@"GET"] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
NSLog(@"RESPONSE!!! /search");
NSLog(@"result %@",result);
NSLog(@"error %@",error);
}];