我正在尝试在用户的墙上发布一条消息,但是作为回应我收到错误“未知方法”。
我的代码是:
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}
答案 0 :(得分:5)
除graphPath
方法中的Request
参数外,一切正常。而不是:
"/" + pickedUsersId.get(0) + "/feed"
做的:
pickedUsersId.get(0) + "/feed"
图形路径前面不应有前导斜杠“/”。您始终可以参考我们的文档,了解如何准确发布Feed。 https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/