【问题标题】:How to get Facebook friends list with birthday information?如何获取包含生日信息的 Facebook 好友列表?
【发布时间】:2014-07-18 14:51:45
【问题描述】:

作为 wp8 应用程序开发的一部分,我们需要在应用程序中显示 Facebook 好友列表,为此我们在 wp8 中使用 FacebookClient。 fb.GetTaskAsync("/me/friends?fields=id,birthday");我们使用这种方法获取朋友列表主要是我们需要每个朋友的姓名,身份证,生日,图片。但我们只得到那个身份证和姓名。见下面的代码

 FacebookClient fb = new FacebookClient(App.AccessToken);

        fb.GetCompleted += (o, e) =>
        {
            if (e.Error != null)
            {
                Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message));
                return;
            }

            var result = (IDictionary<string, object>)e.GetResultData();

            var data = (IEnumerable<object>)result["data"]; ;


            Dispatcher.BeginInvoke(() =>
            {


                foreach (var item in data)
                {
                    var friend = (IDictionary<string, object>)item;

                    FacebookData.Friends.Add(new Friend { Name = (string)friend["name"], id = (string)friend["id"], PictureUri = new Uri(string.Format("https://graph.facebook.com/{0}/picture?type={1}&access_token={2}", (string)friend["id"], "square", App.AccessToken)) });
                }

                NavigationService.Navigate(new Uri("/Pages/FriendSelector.xaml", UriKind.Relative));
            });

        };


        fb.GetTaskAsync("/me/friends?fields=id,name,birthday");

【问题讨论】:

  • 这是不可能的。在 API v2.0 中,您只会获得也在使用该应用程序的朋友,而不是所有朋友

标签: c# facebook windows-phone-8


【解决方案1】:

简单的答案:Graph API v2.0 无法做到这一点,因为

【讨论】:

    【解决方案2】:

    在您用来检索信息的任何环境中使用 Opengraph API。生日在链接下方的用户信息对象视图中

    https://developers.facebook.com/docs/graph-api/reference/v2.0/user

    【讨论】:

    • 这里的评论会很有帮助。引用的页面似乎确实表明生日是一个现有参数。
    猜你喜欢
    • 2012-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-15
    • 2015-03-16
    相关资源
    最近更新 更多