简体   繁体   English

GraphRequest.newMyFriendsRequest返回空列表Android Facebook SDK 4.0+

[英]GraphRequest.newMyFriendsRequest return empty list android facebook sdk 4.0+

I am using the following login method to login 我正在使用以下登录方法登录

ParseFacebookUtils.logInWithReadPermissionsInBackground(this,
                Arrays.asList("user_status", "read_stream", "user_friends", "read_friendlists"), new LogInCallback() {
                    @Override
                    public void done(ParseUser parseUser, ParseException e) {
                        System.out.println("ParseUser: " + parseUser);
                        System.out.println("ParseException: " + e);
                        linkUser(parseUser);
                    }
                });

and using the following method to get my friend list, I need to retrieve all friends 并使用以下方法获取我的朋友列表,我需要检索所有朋友

GraphRequest request1 = GraphRequest.newMyFriendsRequest(AccessToken.getCurrentAccessToken(), new GraphRequest.GraphJSONArrayCallback() {
            @Override
            public void onCompleted(JSONArray jsonArray, GraphResponse graphResponse) {
                Toast.makeText(HomeScreenActivity.this, "" + jsonArray.length(), Toast.LENGTH_SHORT).show();
            }
        });
        request1.executeAsync();

but the jsonArray is always empty, can anyone tell me what is wrong here ? 但是jsonArray始终为空,有人可以告诉我这里出了什么问题吗?

EDIT 编辑

I also get the following value in the Graph Response 我在图响应中也得到以下值

{Response:  responseCode: 200, graphObject: {"summary":{"total_count":476},"data":[]}, error: null}

As from Facebook api docs, this code would return all your friends who have logged in using Facebook in your android app. 从Facebook api文档开始,此代码将返回您所有在Android应用中使用Facebook登录的朋友。 I also faced the same issue but after my friends installed my android app into their devices and logged in with Facebook in the app, this code returned list of all those friends with name and their Facebook ids. 我也遇到了同样的问题,但是当我的朋友们将我的android应用程序安装到他们的设备中并在应用程序中使用Facebook登录后,此代码返回了所有具有名称和Facebook ID的朋友的列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM