C#(Windows Phone)Facebook获取信息
我如何从用户那里获得其他信息,如位置、生日或性别?我使用这段代码作为我正在做的项目的指南 我能够获得用户的id和姓名,但无法获得其他信息。我试图通过添加字符串location=result[“location”].ToString()来获取用户的位置 我最终得到一个空值和一个keynotfoundexception。这是我遇到问题的一段代码C#(Windows Phone)Facebook获取信息,c#,facebook,windows-phone-7,sdk,C#,Facebook,Windows Phone 7,Sdk,我如何从用户那里获得其他信息,如位置、生日或性别?我使用这段代码作为我正在做的项目的指南 我能够获得用户的id和姓名,但无法获得其他信息。我试图通过添加字符串location=result[“location”].ToString()来获取用户的位置 我最终得到一个空值和一个keynotfoundexception。这是我遇到问题的一段代码 void _fbClient_GetCompleted(object sender, FacebookApiEventArgs e) {
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 + ")");
});
void\u fbClient\u GetCompleted(对象发送方,FacebookApiEventArgs e)
{
//将数据转换成字典。
//如果你想看看Facebook正在返回什么,你可以查看它
//使用Facebook提供的这个工具
//http://developers.facebook.com/tools/explorer/?method=GET&path=me
var result=(IDictionary)e.GetResultData();
//获取ID值
字符串id=结果[“id”]。ToString();
//获取名称值
字符串名称=结果[“名称”]。ToString();
//当前正在运行此代码的线程
//不是UI线程,只有UI线程可以更新
//所以我们在这里调用UI线程。
_page.Dispatcher.BeginInvoke(()=>{
MessageBox.Show(name+”(“+id+”);
});
据我所知,您需要将其添加到facebook应用程序扩展权限中,然后要求用户授予您共享这些详细信息的权限
在facebook上寻找更多扩展权限将解决您的问题