2014-10-10 97 views
1

我尝试使用图形api脸谱,但是,我有显示朋友的个人资料图片的问题。这是我的代码如何使用图形api显示朋友照片Facebook

function getPhoto() 
    { 
     FB.api("/"+ userId +"/picture", { 
       "redirect": false, 
       "height": "200", 
       "type": "normal", 
       "width": "200" 
      }, function (response) { 

       //userIds = response.authResponse.; 
       var user = ""; 
       for(var i = 0 ; i < response.data.length ; i++) 
        user += showScore(response.data.url); 

       console.log("photo :"+ response.data.url); 
       //console.log("photo f :"+ response.authResponse.user.id); 
       console.log("photo f :"+ response.data.friends); 

       //$("#score").html(user); 
      } 
     ); 
    } 

请帮帮我,三江源

回答

0

您应该使用

GET /me/friends?fields=picture 

能够得到朋友的照片。但请注意,从Graph API v2.0开始,只会返回那些使用同一应用程序生成请求访问令牌的朋友。

+0

我已经使用FB.api(“/”+ userId +“/ picture”,但它没有工作 – mawlynx 2014-10-10 06:36:21

+0

你没有使用我的例子!什么是“没有工作”是什么意思?结果只是空的?然后没有朋友使用相同的应用程序,正如我解释的那样。 – Tobi 2014-10-10 06:42:28

相关问题