2013-02-15 66 views
0

如何獲取用戶的其他信息,如位置,生日或性別?我使用此代碼作爲我正在執行的項目的指南。 http://windowsphoneaalto.org/2012/01/facebook-get-information-about-the-user/C#(Windows Phone)Facebook獲取信息

我能夠獲得用戶的ID和姓名,但我無法獲得其他信息。我嘗試通過添加string location = result [「location」]來獲取用戶的位置。

我最終得到一個空值和一個keynotfoundexception。這是我遇到的一段代碼。

void _fbClient_GetCompleted(object sender, FacebookApiEventArgs e) 
    { 
     //Turn the data into Dictionary. 
     //If you want to see what the Facebook is returning you can check it 
     //with this tool provided by Facebook 
     //http://developers.facebook.com/tools/explorer/?method=GET&path=me 
     var result = (IDictionary<string, object>)e.GetResultData(); 
     //Get the ID value 
     string id = result["id"].ToString(); 
     //Get the name value 
     string name = result["name"].ToString(); 
     //Currently the thread running this code 
     //is not the UI thread and only UI thread can update 
     //UI. So we are calling the UI thread here. 
     _page.Dispatcher.BeginInvoke(() => { 
      MessageBox.Show(name + " (" + id + ")"); 
     }); 

回答

0

至於我記得你需要將它添加到Facebook應用程序擴展權限,然後要求用戶給你分享這些細節的權利。

查看更多facebook上的擴展權限將解決您的問題