本文介绍了评论上传至Facebook的某一职位与安卓的object_id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好朋友我想张贴在我的Andr​​oid应用程序的Facebook特殊岗位评论,下面是我的code -

我取所有的URL是下面的评论

 捆绑mBundle =新包();
mBundle.putString(信息,测试...... 1234555);
@燮pressWarnings(德precation)
Facebook的FB =新的Facebook(getResources()的getString(R.string.fb_app_id));
尝试{
    fb.request(478409145610921 /评论,mBundle,POST);
}赶上(FileNotFoundException异常五){
    // TODO自动生成catch块
    e.printStackTrace();
}赶上(MalformedURLException的E){
    // TODO自动生成catch块
    e.printStackTrace();
}赶上(IOException异常五){
    // TODO自动生成catch块
    e.printStackTrace();
}

下面我提供了一个环节,你可以看到所有相应的评论列表上方的 OBJECT_ID

<一个href=\"http://api.facebook.com/method/fql.query?format=JSON&query=select%20post_fbid,%20fromid,%20object_id,%20text,%20time%20from%20comment%20where%20object_id%20in%20%28select%20comments_fbid%20from%20link_stat%20where%20url%20=%22http://retirementhomeslisting.com/home-detail/canterbury-place-83%22%29\"相对=nofollow>链接,评论列表478409145610921 OBJECT_ID

当我运行上面code评论没有与各自的object_id张贴所以任何想法,我怎样才能解决呢?
修改答案

 捆绑mBundle =新包();
                        mBundle.putString(信息,测试...... 1234555);
                        @燮pressWarnings(德precation)
                        Facebook的FB =新的Facebook(getResources()的getString(R.string.fb_app_id));
                        尝试{
                        fb.request(1309634065_478409145610921 /评论,mBundle,POST);                        }赶上(FileNotFoundException异常五){
                            // TODO自动生成catch块
                            e.printStackTrace();
                        }赶上(MalformedURLException的E){
                            // TODO自动生成catch块
                            e.printStackTrace();
                        }赶上(IOException异常五){
                            // TODO自动生成catch块
                            e.printStackTrace();
                        }


解决方案

要发布一则讯息的评论,你需要一个 POST_ID 而不是 OBJECT_ID

所以,你的API调用必须是 -

  / {} POST_ID /评论

POST_ID 也是在的表)

编辑:

您必须使用评论插件,并试图张贴到一个注释。不幸的是,Facebook的不要让你做到这一点! (因为LOGICAL-大部分都是公开的,为了避免垃圾邮件,否则任何人都可以淹没评论这一职务)

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

  {
  错误:{
     消息:(#100)评论不能添加到评论插件
     类型:OAuthException,
     code:100
  }
}

您可以测试也。

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

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();
}

Here I provide one link which you can see all comment list with respective above object_id

Link for comment list for 478409145610921 object_id

When i run above code comment is not post with respective object_id so Any idea how can i solve it?EDIT Answer

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();
                        }
解决方案

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.

这篇关于评论上传至Facebook的某一职位与安卓的object_id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 01:00