如何从用户那里获取其他信息,例如位置、生日或性别?我使用这段代码作为我正在做的项目的指南。http://windowsphoneaalto.org/2012/01/facebook-get-information-about-the-user/
我能够获取用户的 ID 和姓名,但无法获取其他信息。我尝试通过添加字符串 location = result["location"].ToString(); 来获取用户的位置
我最终得到了一个空值和一个 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 + ")");
});