3

我试图在用户的墙上发布一条由其 ID 定义的消息,但作为响应,我收到一个错误“未知方法”。

我的代码是:

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

在 LogCat 我有:

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}
4

1 回答 1

5

graphPath除了方法中的参数外,一切看起来都正确Request。代替:

"/" + pickedUsersId.get(0) + "/feed"

做:

pickedUsersId.get(0) + "/feed"

图形路径前不应有前导斜杠“/”。您可以随时参考我们的文档,了解如何准确发布到 Feed。 https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/

于 2012-11-08T21:20:48.803 回答