2016-11-30 71 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用戶的生日。我想我必須提交應用程序審查才能獲得生日詳細信息 –