在Facebook发送消息时出现“缺少消息或附件”错误

4
我正在将Facebook集成到我的应用程序中,这很容易实现。但是,当我试图在墙上发布带有超链接的消息时,我遇到了问题。尝试这样做时,会提示“缺少消息或附件OauthException代码100”,而不带超链接的消息可以成功发布。这是我用于发布墙贴的代码:
JSONObject attachment = new JSONObject();

attachment.put("message", "Messages");
attachment.put("name", "click");
attachment.put("href", "http://www.facebook.com");
Bundle parameters = new Bundle();
parameters.putString("attachment",attachment.toString());
response = mFacebook.request("me/feed", parameters,"POST");`

有人能告诉我哪里出错了吗?谢谢。

1个回答

0

尝试做类似这样的事情:

Bundle parameters = new Bundle();
parameters.putString("message", "Messages");
parameters.putString("name", "click");
parameters.putString("link", "http://www.facebook.com");
response = mFacebook.request("me/feed", parameters, "POST");

@ Niraj谢谢你的建议,但我需要在消息中显示超链接。我认为link key不能做到这一点。 - dharan
您可以使用“link”对象发布超链接。它将使用OpenGraph标签从链接中呈现信息。请使用API Explorer进行测试。 - Niraj Shah

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接