FBSDKGraphRequest Response Issue - Not getting scores

前端 未结 4 1259
小蘑菇
小蘑菇 2021-01-27 03:19

I am using following code to get the game score of my facebook friend.

    -(void)GetFriendScore
{
    NSMutableDictionary* params =   [NSMutableDictionary dicti         


        
相关标签:
4条回答
  • 2021-01-27 03:58
    param.putString("fields", "user,application,score");
    request = new Request(Session.getActiveSession(), "/me/scores", param , HttpMethod.GET);
    if(request!=null)
    {
        request.setCallback(new Request.Callback()
        {
            public void onCompleted(Response response)
            {
                        if(response!=null)
                        {
                            GraphObject graphObject = response.getGraphObject();
                            if(graphObject==null)
                            {
                                //Enjoy
                            }
    
                        }
            }
        }
    }
    
    0 讨论(0)
  • 2021-01-27 04:03

    Solved by using following code.

    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                  initWithGraphPath:@"/me/scores?fields=user,application,score"
                                  parameters:params
                                  HTTPMethod:@"GET"];
    
    0 讨论(0)
  • 2021-01-27 04:11

    Looks like you're using Graph API v2.4. With that, you'll have to specify each field you want to have returned. See my answer for a similar question here:

    • Graph API Score with GET method can't return score field

    You need to request /{app_id}/scores?fields=user,application,score instead of /me/scores?fields=user,application,score I guess if you also want to see the friend's scores

    See

    • https://developers.facebook.com/docs/graph-api/reference/v2.4/app/…

    Alternatively,

    /me?fields=scores{user,application,score},friends{scores{user,application,score}‌​}
    

    should work as well

    0 讨论(0)
  • 2021-01-27 04:13

    How we can do same in android.i have same problem in android i am using following code

    request = new Request(Session.getActiveSession(), "/ "+"FB_ID"+"/scores?fields=user,application,score", param , HttpMethod.GET);
    if(request!=null)
    {
        request.setCallback(new Request.Callback()
        {
            public void onCompleted(Response response)
            {
                        if(response!=null)
                        {
                            GraphObject graphObject = response.getGraphObject();
                            if(graphObject==null)
                            {
                                //getting graphObject NULL
                            }
    
                        }
            }
        }
    }
    

    how to resolve this issue

    0 讨论(0)
提交回复
热议问题