0

朋友你好我想要发布到特定文章评论了Facebook与我的Android应用程序,下面是我的代码 -上传评论分享到Facebook的特定职位与OBJECT_ID安卓

我获取所有评论的URL,低于

http://retirementhomeslisting.com/home-detail/canterbury-place-83

Bundle mBundle=new Bundle(); 
mBundle.putString("message","testing...1234555"); 
@SuppressWarnings("deprecation") 
Facebook fb=new Facebook(getResources().getString(R.string.fb_app_id)); 
try { 
    fb.request("478409145610921/comments",mBundle,"POST"); 
} catch (FileNotFoundException e) { 
    // TODO Auto-generated catch block 
    e.printStackTrace(); 
} catch (MalformedURLException e) { 
    // TODO Auto-generated catch block 
    e.printStackTrace(); 
} catch (IOException e) { 
    // TODO Auto-generated catch block 
    e.printStackTrace(); 
} 

这里我提供一个链接,你可以看到上面各自所有评论列表object_id

Link for comment list for 478409145610921 object_id

,当我运行上面的代码注释不会与各自的object_id张贴所以任何想法,我怎样才能解决呢? 编辑答案

Bundle mBundle=new Bundle(); 
         mBundle.putString("message","testing...1234555"); 
         @SuppressWarnings("deprecation") 
         Facebook fb=new Facebook(getResources().getString(R.string.fb_app_id)); 
         try { 
         fb.request("1309634065_478409145610921/comments",mBundle,"POST"); 

         } catch (FileNotFoundException e) { 
          // TODO Auto-generated catch block 
          e.printStackTrace(); 
         } catch (MalformedURLException e) { 
          // TODO Auto-generated catch block 
          e.printStackTrace(); 
         } catch (IOException e) { 
          // TODO Auto-generated catch block 
          e.printStackTrace(); 
         } 

回答

3

要发布一则讯息的评论,你需要的不是post_idobject_id

所以,你的API调用必须 -

/{post_id}/comments 

post_id也是在comments表中的字段)

编辑:

您必须使用评论插件,并试图发表评论。不幸的是,Facebook不允许你这样做! (Logical-因为他们大多数是公开的,为了避免垃圾邮件,否则任何人都可以淹没评论这一职务)

如果您在此处检查响应,你会得到:

{ 
    "error": { 
    "message": "(#100) Comments may not be added to a comment plugin", 
    "type": "OAuthException", 
    "code": 100 
    } 
} 

您可以测试这些API调用Graph API Explorer也。

+0

萨赫勒米塔尔:POST_ID在我的情况post_fbid我得到上述JSON甲是你说什么? –

+0

不,更改您的查询。 [Check this link](http://api.facebook.com/method/fql.query?format=JSON&query=select%20post_fbid,post_id,%20fromid,%20object_id,%20text,%20time%20from%20comment%20where% 20object_id%20英寸%20%28select%20comments_fbid%20from%20link_stat%20where%20url%20 =%22http://retirementhomeslisting.com/home-detail/canterbury-place-83%22%29)。您的邮件地址是'1309634065_478409145610921' –

+0

Sahil Mittal:我尝试了您的代码,但仍未在帖子中发表评论!请参阅我的编辑代码。 –

0

使用图形API:

... 
if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"]) { 
    [[[FBSDKGraphRequest alloc] 
     initWithGraphPath:@"post_id/likes" 
     parameters: @{ @"like" : @"true"} 
     HTTPMethod:@"POST"] 
     startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 
     if (!error) { 
      NSLog(@"It was liked."); 
     } 
    }]; 
} 
...