1

试图获取用户HomeTimeLine,但我得到以下异常

Newtonsoft.Json.dll 中发生“System.NullReferenceException”

我的代码看起来像:

        **OAuthTokens tokens = new OAuthTokens();
        TimelineOptions properties = new TimelineOptions();

        tokens.AccessToken = "myaccessToke";
        tokens.AccessTokenSecret = "my secret accss token";
        tokens.ConsumerKey = "my consumer key";
        tokens.ConsumerSecret = "my consomer secret";
        properties.UseSSL = true;
        properties.IncludeRetweets = true;

        //Pas besoin de parser avec Twitterizer

        try
        {
            TwitterResponse<TwitterStatusCollection> timelineResponse =   TwitterTimeline.HomeTimeline(tokens, properties);
            foreach (var item in timelineResponse.ResponseObject)
            {
                String textStatus = item.Text;
            }
        }
        catch (Exception e)
        {
            Debug.WriteLine("Error message :"+e.Message);
        }**

当我尝试使用相同的代码来获取朋友时间线时,它可以正常工作,例如:

TwitterResponse<TwitterStatusCollection> timelineResponse =
TwitterTimeline.FriendTimeline(tokens);

请大家帮忙,谢谢

4

0 回答 0