为ios.Xamarin App回拨twitter的URL

时间:2017-01-09 06:24:41

标签: ios twitter-bootstrap twitter xamarin.ios

我开发了一个应用程序,我需要使用google plus,twitter和Facebook授权我的应用程序,一旦授权,我需要重定向到我自己的应用程序。但我无法返回到我的应用程序的Twitter和Google Plus

partial  void BtnTwitter_TouchUpInside(UIButton sender)
    {
      var auth1 = new OAuth1Authenticator(
         "Consumer key",
         "Consumer Secret",
         new Uri("https://api.twitter.com/oauth/request_token"),
         new Uri("https://api.twitter.com/oauth/authorize"),
         new Uri("https://api.twitter.com/oauth/access_token"),
         new Uri("https://twitter.com"));



        //auth1.Completed += OnAuthenticationCompleted;
        //  var ui = auth1.GetUI();

        PresentViewController(auth1.GetUI(), true, HandleAction);
        //save the account data in the authorization completed even handler
        auth1.Completed += async (s, eventArgs) =>
        {
            if (eventArgs.IsAuthenticated)
            {

                loggedInAccount = eventArgs.Account;

                AccountStore.Create().Save(loggedInAccount, "Twitter");
                GetTwitterData();
                DismissViewController(true, null);

            }
        };

        var ui = auth1.GetUI();
        PresentViewController(ui, true, null);
    }

0 个答案:

没有答案