【问题标题】:Windows Phone 8 - Twitter APIWindows Phone 8 - 推特 API
【发布时间】:2014-01-03 19:38:01
【问题描述】:

我正在做一些研究,但似乎找不到明确的方法来查询 Twitter 的 API 以使用 C# 在 WP8 上获取用户的推文。

twitter 用户不是我自己的帐户,我想做的只是检索推文并且发布任何推文。

因此我需要对自己/我的应用进行身份验证吗? TweetSharp 库是否适合我的目标?

【问题讨论】:

    标签: c# twitter windows-phone-8


    【解决方案1】:

    我用下面的例子http://code.msdn.microsoft.com/wpapps/Twitter-Sample-using-f36bab75:

    if (NetworkInterface.GetIsNetworkAvailable())
    {
        //Obtain keys by registering your app on https://dev.twitter.com/apps
        var service = new TwitterService("abc", "abc");
        service.AuthenticateWith("abc", "abc");
    
        //ScreenName is the profile name of the twitter user.
        service.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions() { ScreenName = "the_appfactory" }, (ts, rep) =>
        {
            if (rep.StatusCode == HttpStatusCode.OK)
            {
                //bind
                this.Dispatcher.BeginInvoke(() => { tweetList.ItemsSource = ts; });
            }
        });
    }
    else
    {
    
        MessageBox.Show("Please check your internet connestion.");
    }
    

    我在 twitter 开发网站上创建了一个新的应用程序用户:https://dev.twitter.com/user/login?destination=home。设置完成后,我基本上复制并粘贴了 AuthenticateWithTwitterService 方法中的密钥。

    我还没有完全解决如何显示数据,但是在运行时,我可以看到正在传入的数据。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-26
      • 1970-01-01
      相关资源
      最近更新 更多