2012-02-22 12 views
0

Twitter APIを使い始め、Twitterizerライブラリを使用してAPIとのインターフェイスをとることを選択しました。現在、テストプロジェクトを使用して簡単な作業を行っていますが、私はフォーラムやここでスタックに関する情報を見つけることができないような問題に遭遇しました。Twitterizerオブジェクトリファレンスが設定されていません

Twitterizerバージョン2.4(NuGet)を使用して

  1. NewtonSoft JSONバージョン4.0.2を使用して
  2. .NET 4.0/MVC(なぜならシリアライズの問題の4.0.8からダウングレードしなければならなかった)のセットアッププロジェクト

ここでは、例外がスローされたコードスニペットです:

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); 

最後の行がNullのRef例外を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) 

私は、ライブラリ内のnull参照の例外について前の質問を見てきましたが、その問題は、(以前のバージョンにありました2.3.1)。誰かがこれを見つけた/私はこの関数/ etcに送信すべき何かを知っていますか?私は問題なくTimeline.MentionsとUser.GetFollowers関数を正常に使用したと言わなければなりません。これは、ライブラリがいくらか正しく設定されていることを示しています。

答えて

0

Ok - 私はそれを持っているかもしれません最初にもう少しテストをしてください。この特定の関数は、2番目のパラメータとしてRetweetsOfMeOptionsのオーバーロードされたバージョンを持っています。私の例では、このバージョンを使用していませんでした。私はこのコード行追加した場合しかし、:

var options = new RetweetsOfMeOptions {Count = 25, UseSSL = false}; 

をそして、私の関数呼び出しがオーバーロードの呼び出しを使用するように更新します。

TwitterResponse<TwitterStatusCollection> mentionsResponse = TwitterTimeline.RetweetsOfMe(oAuthToken, options); 

私はエラーを取得できませんでした。一度これが確定したら、私はTwitterizerフォーラム/バグトラッカーに潜在的な問題として投稿します。

関連する問題