2014-10-10 72 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

相關問題