Facebook Graph API for iOSsearch

我正在尝试使用下面的代码从GraphAPIsearch位置,但没有运气。 任何人都可以请我的道路?

如果我尝试发布链接/消息/照片,它按预期工作,但是当试图获取位置时,它总是失败,并给我**The operation couldn't be completed. (facebookErrDomain error 10000.)** **The operation couldn't be completed. (facebookErrDomain error 10000.)**

 //Following statement is using permissions NSArray * permissions = [NSArray arrayWithObjects:@"publish_stream",@"user_checkins", @"friends_checkins", @"publish_checkins", nil]; [facebook authorize:FB_APP_ID permissions:permissions delegate:_delegate]; NSString *centerString = [NSString stringWithFormat: @"%f,%f", 37.76,-122.427]; NSString *graphPath = @"search"; NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"coffee",@"q", @"place",@"type", centerString,@"center", @"1000",@"distance", // In Meters (1000m = 0.62mi) nil]; [facebook requestWithGraphPath:_path andParams:_params andHttpMethod:@"POST" andDelegate:_delegate]; 

没关系。 从facebook下载了最新的示例HackBook forgraphicsapi,它包含相同的示例代码。

对于“search”,你应该使用“GET”而不是“POST”。

https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#search

使用Facebook iOS SDK,login后可以使用FBRequestConnection。

  [FBRequestConnection startWithGraphPath:@"search?q=coffee&type=place&center=37.76,-122.427&distance=1000" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { if (!error) { // Sucess! Include your code to handle the results here NSLog(@"result: %@", result); } else { // An error occurred, we need to handle the error // See: https://developers.facebook.com/docs/ios/errors NSLog(@"error: %@", error); } }]; 

使用最后一个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); }];