在使用Android Facebook SDK时,我能够成功向我/ Feed发送消息(所以我猜问题不在于会话状态或权限),而是发布链接(带有附加参数)失败并出现错误:
{Response: responseCode: 500, graphObject: null, error: {HttpStatus: 500, errorCode: 100, errorType: FacebookApiException, errorMessage: Invalid parameter}, isFromCache:false}
我使用经过确认可在其他应用中使用的硬编码参数。
这个错误意味着什么?
答案 0 :(得分:-1)
我有同样的问题,我在它之间循环,并在尝试修复它时需要上传文件权限错误。 我正在分享两种类型的帖子:状态和照片,使用链接
https://www.facebook.com/permalink.php?story_fbid= {POST-ID}和ID = {PAGE-ID} 要么 https://www.facebook.com/ {PAGE-ID} /帖/ {POST-ID}
但最近我发现facebook似乎已经做了一些更改,这种方式停止了为照片工作,让它工作的唯一方法是使用图形api获取与post对象存在的帖子链接和用它来发布。
从帖子中获取链接的示例:
Request request = new Request(Session.getActiveSession(), mPageID+ "/posts", null, HttpMethod.GET, new Request.Callback() {
public void onCompleted(Response response) {
GraphMultiResult list = response.getGraphObjectAs(GraphMultiResult.class);
if (list != null) {
GraphObjectList<GraphObject> graphOList = list.getData();
for (int i = 0; i < graphOList.size(); i++) {
GraphObject graphObjectItem = graphOList.get(i);
if (graphObjectItem != null) {
Post p = new Post();
if (graphObjectItem.getProperty("link") != null)
p.setURL(graphObjectItem.getProperty("link").toString());
if (graphObjectItem.getProperty("id") != null) {
p.setPostID(graphObjectItem.getProperty("id").toString());
}
}
}
}
}
});
// i use execute and wait because i'm calling the function inside a background task
Request.executeAndWait(request);
我以前共享链接的功能:
public static void sharePost(String message, String link){
Bundle b = new Bundle();
b.putString("message", message);
b.putString("link", link);
b.putString("access_token", Session.getActiveSession().getAccessToken());
Request postRequest = new Request(Session.getActiveSession(),
"/me/feed", b, HttpMethod.POST, new Request.Callback() {
@Override
public void onCompleted(Response response) {
responseMessage = response.toString();
}
});
Request.executeAndWait(postRequest);
}