与SDK 3.0发布在Facebook上墙 [英] Posting on facebook wall with sdk 3.0
问题描述
我想发表它的ID定义用户的墙上的消息,但在回应我得到一个错误未知的方法。
我的code是:
最后捆绑PARAMS =新包();
params.putByteArray(信息,测试.getBytes());
params.putByteArray(名,美国圣母.getBytes());
params.putByteArray(链接,http://bit.ly/12345.getBytes());
params.putByteArray(说明,一年级女大学生从一个奖学金......的GetBytes());
params.putByteArray(图片,的http://xxx/MOV1026.jpg.getBytes());
最后请求postToWall = Request.newRestRequest(Session.getActiveSession()
/+ pickedUsersId.get(0)+/饲料,参数,可以HttpMethod.POST);
postToWall.setCallback(新Request.Callback()
{
@覆盖
公共无效onCompleted(响应响应)
{
Log.i(Utils.LOG,response.toString());
}
});
Request.executeBatchAsync(postToWall);
在LogCat中我有:
11-08 17:34:29.136:I / LOG(21699):{响应:响应code:200,graphObject:空,错误:{FacebookServiceErrorException:HTT presponse code:200,facebookError code:3,facebookErrorType:空,消息:未知的方法},isFromCache:假}
一切看起来正确的,除非你的请求的
方法。相反的: graphPath
参数
/+ pickedUsersId.get(0)+/饲料
做的:
pickedUsersId.get(0)+/饲料
有不应该在你的曲线路径前的斜线/。您可以随时参阅文档,以了解究竟如何发布养活。 <一href="https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/">https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/
I'm trying to post a message on user's wall defined by it's ID, but in response I'm getting an error "Unknown method".
My code is:
final Bundle params = new Bundle();
params.putByteArray("message", "Test".getBytes());
params.putByteArray("name", "American Virgin".getBytes());
params.putByteArray("link", "http://bit.ly/12345".getBytes());
params.putByteArray("description", "A Freshman College Girl on a scholarship from an ...".getBytes());
params.putByteArray("picture", "http://xxx/MOV1026.jpg".getBytes());
final Request postToWall = Request.newRestRequest(Session.getActiveSession(),
"/" + pickedUsersId.get(0) + "/feed", params, HttpMethod.POST);
postToWall.setCallback( new Request.Callback()
{
@Override
public void onCompleted(Response response)
{
Log.i(Utils.LOG, response.toString());
}
});
Request.executeBatchAsync(postToWall);
In LogCat i have:
11-08 17:34:29.136: I/LOG(21699): {Response: responseCode: 200, graphObject: null, error: {FacebookServiceErrorException: httpResponseCode: 200, facebookErrorCode: 3, facebookErrorType: null, message: Unknown method}, isFromCache:false}
Everything looks right except the graphPath
parameter in your Request
method. Instead of:
"/" + pickedUsersId.get(0) + "/feed"
do:
pickedUsersId.get(0) + "/feed"
There should not be a leading slash "/" in front of your graph path. You can always refer to our documentation to see how exactly to publish to feed. https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/
这篇关于与SDK 3.0发布在Facebook上墙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!