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函数没有问题,所以这告诉我我的库配置有点正确...