gpt4 book ai didi

java - com.facebook.FacebookException : could not construct request body

转载 作者:行者123 更新时间:2023-11-30 03:31:03 24 4
gpt4 key购买 nike

直到昨天,我的应用程序才可以将 feed 故事发布到 facebook。

现在它停止工作并在回调中发送此错误:

“com.facebook.FacebookException:无法构造请求正文”

这来自:

    response.getError();

奇怪的是,来自 facebook 的示例应用程序停止工作,现在报告相同的错误,我很确定我没有对它进行任何更改。

这是示例应用程序功能:

    private void publishStory() {
Session session = Session.getActiveSession();

if (session != null){

// Check for publish permissions
List<String> permissions = session.getPermissions();
if (!isSubsetOf(PERMISSIONS, permissions)) {
pendingPublishReauthorization = true;
Session.NewPermissionsRequest newPermissionsRequest = new Session
.NewPermissionsRequest(this, PERMISSIONS);
session.requestNewPublishPermissions(newPermissionsRequest);
return;
}

Bundle postParams = new Bundle();
postParams.putString("name", "Facebook SDK for Android");
postParams.putString("caption", "Build great social apps and get more installs.");
postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
postParams.putString("link", "https://developers.facebook.com/android");
postParams.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");

Request.Callback callback= new Request.Callback() {
public void onCompleted(Response response) {
FacebookRequestError error = response.getError();
if (error != null) {
Toast.makeText(getApplicationContext(),
error.getErrorMessage(),
Toast.LENGTH_SHORT).show();
return;
}


JSONObject graphResponse = response
.getGraphObject()
.getInnerJSONObject();
String postId = null;
try {
postId = graphResponse.getString("id");
} catch (JSONException e) {
Log.i("publishStory",
"JSON error "+ e.getMessage());
}

Toast.makeText(getApplicationContext(), postId,Toast.LENGTH_LONG).show();
}
};

Request request = new Request(session, "me/feed", postParams,
HttpMethod.POST, callback);

RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}

}

谁能帮忙啊!提前谢谢你。

最佳答案

现在可以了...我在晚上关闭了计算机和 Eclipse,现在重新启动了

我猜这是编译器中的一些错误。

关于java - com.facebook.FacebookException : could not construct request body,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17476777/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com