2013-02-15 68 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上的扩展权限将解决您的问题