【问题标题】:Getting Twitter Home timeline throw Error in windows Phone App Using twitter Api v1.1使用twitter Api v1.1在windows Phone App中获取Twitter主页时间线抛出错误
【发布时间】:2013-08-14 07:59:19
【问题描述】:

我正在尝试在我的 Windows Phone 应用程序中获取我的 Twitter 主页时间线中的最新推文

听到是我的代码:

public void LoadData()
{
     WebClient tweetclient = new WebClient();
     string purl = string.Format("https://api.twitter.com/1.1/statuses/home_timeline.json?screen_name={0}&count=10", App.Tscreenname);
     tweetclient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(tweetclient_DownloadStringCompleted);
     tweetclient.DownloadStringAsync(new System.Uri(purl, UriKind.Absolute));
}

private void tweetclient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
     var response = e.Result;
     var jsonData = JsonConvert.DeserializeObject<RootObject>(response);
}

我的 e.Result 出现错误

错误:“System.Net.WebException”类型的异常发生在 System.ni.dll 但未在用户代码中处理

我该如何解决这个问题?

【问题讨论】:

    标签: c# twitter windows-phone


    【解决方案1】:

    Twitter API 1.1 不允许您进行未经身份验证的 Web 服务调用。您需要使用 OAuth 或 App only 身份验证进行身份验证。
    详情:https://dev.twitter.com/docs/api/1.1/overview#Authentication_required_on_all_endpoints

    【讨论】:

      猜你喜欢
      • 2013-06-13
      • 1970-01-01
      • 1970-01-01
      • 2014-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-18
      • 2013-07-06
      相关资源
      最近更新 更多