简体   繁体   English

Android FaceBook newMyFriendsRequest返回EMPTY朋友列表

[英]Android FaceBook newMyFriendsRequest Returns EMPTY Friends List

I'm developing my first Android App using Parse and Facebook, so I'm pretty new to it. 我正在使用Parse和Facebook开发我的第一个Android应用程序,所以我很陌生。

I'm trying to retrieve the User's Friend List with Request.newMyFriendsRequest() but it gives me an empty list when testing with real users. 我正在尝试使用Request.newMyFriendsRequest()检索用户的朋友列表,但是当与真实用户进行测试时,它给了我一个空列表。

As far as I know, with Graph API v2.0 this request only will return the set of the person's friends who also use the app. 据我所知,使用Graph API v2.0此请求只会返回也使用该应用程序的朋友的集合。

For that purpose I created a fake Fb profile, I became friend with him in Facebook with my real profile, installed my app, registered with ParseUser and Linked with Facebook using ParseFacebookUtils.link with both profiles, but the Request returns an empty list of friends . 为此,我创建了一个虚假的Fb个人资料,我在Facebook上用我的真实个人资料与他成为朋友,安装了我的应用程序,在ParseUser注册,并使用ParseFacebookUtils.link和Facebook与这两个个人资料进行了链接,但请求返回一个空的朋友列表

I've created several Test Users in Facebook's App dashboard, and simulated several friendships between them. 我已经在Facebook的App仪表板上创建了多个“ 测试用户” ,并模拟了他们之间的几种友谊。 I made the same process in my app (register with parseUser , link with ParseFacebookUtils.link ) with two of them, and the list users.size() returns 2 friends as expected. 我做了同样的过程在我的应用程序(寄存器与parseUser ,与链接ParseFacebookUtils.link其中两个),并且列表users.size() 的预期收益2个朋友。

Why it doesn't work with my actual profile and the fake one (which is like any other real one)?? 为什么它与我的实际个人资料和伪造的个人资料(与其他任何真实的个人资料一样)不起作用?

This is how I'm linking profiles: 这是我链接个人资料的方式:

List<String> permissions = new ArrayList<String>();
permissions.add("public_profile");
permissions.add("user_friends");

ParseFacebookUtils.link(currentUser, permissions, MainActivity.this, new SaveCallback() {
     @Override
     public void done(ParseException ex) {
          if (ParseFacebookUtils.isLinked(currentUser)) {
             Log.d(TAG, "Woohoo, user logged in with Facebook!");
             Toast.makeText(getApplicationContext(), "Facebook succesfully linked", Toast.LENGTH_LONG).show();
          }
          if (ex != null) {
             Log.d (TAG, ex.getLocalizedMessage() + "\n + Exception Code: " + ex.getCode());
          }
     });

And this how I Request friends: 这就是我要求朋友的方式:

Request.newMyFriendsRequest(ParseFacebookUtils.getSession(), new GraphUserListCallback() {
    @Override
    public void onCompleted(List<GraphUser> users, Response response) {
         Log.d(TAG, "Request Completed!! " + response.toString() + "----" + users.size());
         if (users != null) {
             List<String> friendsList = new ArrayList<String>();
             for (GraphUser user : users) {
                friendsList.add(user.getId());
             }
         }
    }
}).executeAsync();.

But I can't figure out how to get the friends list of a real user. 但是我不知道如何获取真实用户的好友列表。 With my profile it should return 1 friend who is also registered using the app being developed... 用我的个人资料,它应该返回1个朋友,该朋友也正在使用正在开发的应用程序进行注册...

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

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