0
開始玩弄Twitter API並選擇使用Twitterizer庫與API進行接口。目前使用測試項目來完成一些簡單的任務,我遇到了一個問題,我似乎無法在論壇或堆棧中找到任何信息。Twitterizer對象參考未設置
的設置
- 使用Twitterizer版本2.4(的NuGet)
- 使用NewtonSoft JSON版本4.0.2(已經從4.0.8由於序列化問題在降級)
- .NET 4.0/MVC項目
這裏是拋出異常的代碼片段:
var token = dbContext.TwitterProfiles.Where(x => x.TwitterId == MySuperSecretId).First();
var oAuthToken = new OAuthTokens
{
AccessToken = token.Token,
AccessTokenSecret = token.Secret,
ConsumerKey = ConfigurationManager.AppSettings["TwitterConsumerKey"],
ConsumerSecret = ConfigurationManager.AppSettings["TwitterConsumerSecret"]
};
TwitterResponse<TwitterStatusCollection> mentionsResponse = TwitterTimeline.RetweetsOfMe(oAuthToken);
最後一行pukes了一個空參考異常
堆棧跟蹤:
at Twitterizer.Commands.RetweetsOfMeCommand.Init()
at Twitterizer.Core.CommandPerformer.PerformAction[T](ICommand`1 command)
at Twitterizer.TwitterTimeline.RetweetsOfMe(OAuthTokens tokens, RetweetsOfMeOptions options)
at Twitterizer.TwitterTimeline.RetweetsOfMe(OAuthTokens tokens)
at TwitterTest.Controllers.HomeController.GetRetweets() in C:\Users\Tommy\Documents\Visual Studio 2010\Projects\TwitterTest\TwitterTest\Controllers\HomeController.cs:line 85
at lambda_method(Closure , ControllerBase , Object[])
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
我已經看到了關於在圖書館一個空引用異常前面的問題,但這個問題是在以前的版本( 2.3.1)。任何人都遇到過/知道一個參數或我應該發送到這個函數/ etc?我應該說,我成功地使用了Timeline.Mentions和User.GetFollowers函數沒有問題,所以這告訴我我的庫配置有點正確...