[英]Facebook SDK 3.22 (android) - me/friends return wrong user's friends id
我希望我的应用程序也获得使用过该应用程序的用户的朋友的ID和名称,并通过名称查找我需要的ID。 然后,我想使用带有参数“ TO”的提要对话框将其发布到朋友的墙上。 我以为会很容易。 只是使用me/friends
。 这是要求:
if(session.getState().isOpened()){
Log.i(TAG, "Creating request");
Request friendRequest = new Request(session, "/me/friends", null, HttpMethod.GET, new Request.Callback() {
public void onCompleted(Response response) {
Log.w(TAG, "Complete!" + response.toString());
JSONArray usersArrays = new JSONArray();
try {
Log.i(TAG, "Converting to userObject");
usersArrays = response.getGraphObject().getInnerJSONObject().getJSONArray("data");
for (int i = 0; i < usersArrays.length(); i++){
Log.i(TAG, "Reading " + i + " user");
JSONObject user = usersArrays.getJSONObject(i);
Log.i(TAG, "Getting name and id");
String userId = user.getString("id");
String userName = user.getString("name");
Log.i(TAG, "Now checking: " + userName + " with id: " + userId);
if (userName.equals(name)){
Log.w(TAG, "He was found! Here is his id: " + userId);
postToWall(userId);
} else if (i == (usersArrays.length() - 1)){
Log.e(TAG, name + " does not use the app yet!");
//no ways
}
}
} catch (JSONException e) {
Log.e(TAG, "Error: " + e);
Toast.makeText(context, "Error", Toast.LENGTH_LONG).show();
}
}
}
);
Log.i(TAG, "Sending request");
friendRequest.executeAndWait();
这是我的回复:
{Response: responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"summary":{"total_count":46},"data":[{"id":"383791018465143","name":"Friend Name"}],"paging":{"next":"..."}}}, error: null, isFromCache:false}
然后我找到了这个网站,并决定找出朋友的身份证。 不一样
使用Feed对话框时,我的应用程序因Facebook错误崩溃: incorrect user
错误。 我该怎么办?
预先感谢,谢尔盖
正如@MingLi所说,我无法获取用户朋友的Facebook ID
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.