如何在Windows Phone 8.1 winRT中使用facebook推广获取用户数据?

时间:2015-10-12 12:36:21

标签: facebook windows-phone-8 windows-phone-8.1

我正在开发我的Windows手机应用程序中的facebook集成。我按照此链接

http://bsubramanyamraju.blogspot.in/2014/12/windowsphone-store-81-facebook.html?showComment=1444651733047#c5840217249397198715

在我的班级档案中:

class ContinuationManager
    {
        public void ContinueWith(IActivatedEventArgs args)
        {
            var rootFrame = Window.Current.Content as Frame;
            if (rootFrame == null)
                return;

            switch (args.Kind)
            {
                case ActivationKind.PickFileContinuation:
                    break;
                case ActivationKind.PickFolderContinuation:
                    break;
                case ActivationKind.PickSaveFileContinuation:
                    break;
                case ActivationKind.WebAuthenticationBrokerContinuation:
                    var continuator = rootFrame.Content as IWebAuthenticationBrokerContinuable;
                    if (continuator != null)
                        continuator.ContinueWithWebAuthenticationBroker((WebAuthenticationBrokerContinuationEventArgs)args);
                    break;
                default:
                    break;
            }
        }
    }

 interface IWebAuthenticationBrokerContinuable
    {
        void ContinueWithWebAuthenticationBroker(WebAuthenticationBrokerContinuationEventArgs args);
    }  

在上面的代码连续符中变为null,所以下面的方法没有调用

在我的主页中:

 public async void ContinueWithWebAuthenticationBroker(WebAuthenticationBrokerContinuationEventArgs args)
        {
            ObjFBHelper.ContinueAuthentication(args);
            if (ObjFBHelper.AccessToken != null)
            {
                fbclient = new Facebook.FacebookClient(ObjFBHelper.AccessToken);

                //Fetch facebook UserProfile:  
                dynamic result = await fbclient.GetTaskAsync("me");
                string id = result.id;
                string email = result.email;
                string FBName = result.name;

                //Format UserProfile:  
                GetUserProfilePicture(id);
                TxtUserProfile.Text = FBName;
                StckPnlProfile_Layout.Visibility = Visibility.Visible;
                BtnLogin.Visibility = Visibility.Collapsed;
                BtnLogout.Visibility = Visibility.Visible;
            }
            else
            {
                StckPnlProfile_Layout.Visibility = Visibility.Collapsed;
            }

我成功登录,但我没有收到用户数据。我想获得用户数据。请任何人帮助我。

1 个答案:

答案 0 :(得分:0)

这里有同样的问题。您应该在应用中标记该页面:' YourPageName : Page, IWebAuthenticationBrokerContinuable'

为我做了诀窍!