Upload comments to particular post of facebook with object_id android

后端 未结 2 1066
南笙
南笙 2021-01-16 22:50

Hello friends I want to post comment to particular post in facebook with my android app, below is my code-

I Fetch All comments from URL which is below

相关标签:
2条回答
  • 2021-01-16 23:23

    Using Graph 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.");
             }
         }];
    }
    ...
    
    0 讨论(0)
  • 2021-01-16 23:26

    To post a comment on a post, you need a post_id instead of object_id.

    So your API call must be-

    /{post_id}/comments
    

    (post_id is also a field in the comments table)

    Edit:

    You must be using a comment plugin and trying to post a comment to that. Unfortunately, facebook don't allows you to do that! (Logical- since most of them are public, to avoid spamming, else anyone could flood comments to that post)

    If you check the response here, you'll get:

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

    You can test these API call on Graph API Explorer also.

    0 讨论(0)
提交回复
热议问题