我正在使用适用于 Android 的 Facebook SDK 3.0(最终版本)。当我尝试在已登录用户的提要上发布新状态时,我有时(并非总是)NullPointerException
得到一个。.getInnerJSONObject()
以下是我在里面使用的代码new Request.Callback(){}
:
public void onCompleted(Response response) {
JSONObject graphResponse = response
.getGraphObject()
.getInnerJSONObject();
String postId = null;
try {
postId = graphResponse.getString("id");
} catch (JSONException e) {
Log.d("", "JSON error "+ e.getMessage());
}
FacebookRequestError error = response.getError();
if (error != null) {
Toast.makeText(SessionLoginSampleActivity.this, error.getErrorMessage(), Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(SessionLoginSampleActivity.this, "Post successful " + postId, Toast.LENGTH_LONG).show();
}
}