我正在尝试使用
参加活动的Facebook用户Request.executePostRequestAsync(...)
但服务器始终返回以下内容:
{Response: responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"FACEBOOK_NON_JSON_RESULT":false}}, error: null, isFromCache:false}
身份验证有效,我可以获取用户信息等等...我尝试了我的Graph API Explorer链接并且它在那里工作,所以我的代码应该有问题。 我也检查了我的权限,他们没事。 如果有人可以帮助我,我会很高兴,这是我的代码:
List<String> permissions = new ArrayList<String>();
permissions.add("rsvp_event");
private void attendToEvent(final String eventID){
Session.openActiveSession(MainActivity.this, true, new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
Session actSession = Session.getActiveSession();
if (!hasRSVPEventPermission() && actSession.isOpened()) {
actSession.requestNewPublishPermissions(new Session.NewPermissionsRequest(MainActivity.this, permissions));
}
String accessToken = actSession.getAccessToken();
String path = new String("https://graph.facebook.com/"+eventID+"/attending");
if(session != null && session.isOpened()){
JSONObject jo = new JSONObject();
final GraphObject go = GraphObject.Factory.create(jo);
Request.executePostRequestAsync(session, path, go, new Request.Callback() {
//Request.executeGraphPathRequestAsync(session, path, new Request.Callback() {
@Override
public void onCompleted(Response response) {
System.out.println(response.toString());
showAttendResult(response.getGraphObject(), response.getError());
}
});
}
}
});
}
private boolean hasRSVPEventPermission() {
Session session = Session.getActiveSession();
return session != null && session.getPermissions().contains("rsvp_event");
}
答案 0 :(得分:1)
我发现了! 问题是,而不是这条道路:
String path = new String("https://graph.facebook.com/"+eventID+"/attending");
Graph API期望:
String path = new String(eventID+"/attending");