我正尝试在由其 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}
最佳答案
除了 Request
方法中的 graphPath
参数外,一切看起来都正确。而不是:
"/"+ pickedUsersId.get(0) + "/feed"
做:
pickedUsersId.get(0) + "/feed"
图形路径前不应有前导斜杠“/”。您可以随时引用我们的文档,了解如何准确发布到 Feed。 https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/
关于android - 使用 sdk 3.0 在 facebook 墙上发帖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13290047/