簡體   English   中英

Facebook SDK 3.22(android)-我/朋友返回錯誤的用戶的朋友ID

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM