2016-11-30 75 views
1

我使用xamarin.forms有PCL项目中的两个项目的Android和iOS生日范围在Facebook的登录权限没有显示对话框

我已经在我的项目整合的Facebook。 我通过facebook sdk的三个权限public_profile,email,user_birthday。 当我尝试通过Facebook,Facebook的权限对话框页面开放登录,但它要求接受只有两个许可emailpublic_profile,它不问user_birthday许可

以下是我的代码:

public class FacebookLoginButtonRenderer : ButtonRenderer,IFacebook 
    { 
     private static Activity _activity; 

     protected override void OnElementChanged(ElementChangedEventArgs<Button> e) 
     { 
      base.OnElementChanged(e); 

      _activity = this.Context as Activity; 

      if (this.Control != null) 
      { 
       Android.Widget.Button button = this.Control; 
       button.SetOnClickListener(ButtonClickListener.Instance.Value); 
      } 
     } 

     void IFacebook.Logout() 
     { 
      LoginManager.Instance.LogOut(); 
     } 

     private class ButtonClickListener : Object, IOnClickListener 
     { 
      public static readonly Lazy<ButtonClickListener> Instance = new Lazy<ButtonClickListener>(() => new ButtonClickListener()); 

      public void OnClick(View v) 
      { 
       LoginManager.Instance.LogInWithReadPermissions(_activity, new List<string> { "public_profile","email","user_birthday"}); 
      } 
     } 
    } 

    FacebookClient fb = new FacebookClient(AccessToken); 
    fb.GetTaskAsync("me?fields=id,email,first_name,last_name,gender,birthday").ContinueWith(t => 
      { 
       if (!t.IsFaulted) 
       { 

        var obj = (IDictionary<string, object>)t.Result; 
} 
}); 

在登录权限对话框没有要求生日如下图所示的图像

enter image description here

请建议如何解决这个

在此先感谢

+1

你与在应用一个角色的帐户测试这个? – CBroe

回答

1

由于图形API的2.0版,it's不可能得到朋友的生日了。您只能使用user_birthday权限获得授权用户的生日。的修改记录的详细信息:https://developers.facebook.com/docs/apps/changelog

只有一个其他可能性:如果好友授权的应用程序与user_birthday,你可以得到他的生日与下列电话:?/朋友-ID字段=生日

当然,您也需要授权user_friends的用户才能完成这项工作。而且您还可以存储所有授权用户的生日,并且不会浪费额外的API调用。 检查:

How to get friend's birthday list using facebook api?

+0

我不想要朋友生日,我想要登录的Facebook用户的生日。我想我必须提交应用程序审查才能获得生日详细信息 –