내 멋진 라이브러리의 검색 옵션을 사용하여 TwitterAccount에서 짹짹 목록을 표시하려면 Xamarin.IOS Unified App에 LinqToTwitter v3.1.1을 응용 프로그램 전용 인증과 함께 사용하고 있습니다. 그러나 간단한 검색을 실행하면 TwitterQueryProvider에서 처리되지 않은 NullReference 예외가 발생합니다. 다음과 같이LinqToTwitter를 사용하여 NullReferenceException 검색 기능
내가 작성한 코드는 다음과 같습니다 아래의 스택 트레이스의
var credentialStore = new InMemoryCredentialStore
{
ConsumerKey = "MyTwitterKey",
ConsumerSecret = "MyTwitterSecret"
};
var authorizer = new ApplicationOnlyAuthorizer { CredentialStore = credentialStore };
await authorizer.AuthorizeAsync();
var twitterCtx = new TwitterContext(authorizer);
var searchResponse = await (from search in twitterCtx.Search
where search.Type == SearchType.Search
&& search.Query == "Microsoft"
select search)
.SingleOrDefaultAsync();
if (searchResponse != null && searchResponse.Statuses != null)
{
foreach (var tweet in searchResponse.Statuses)
{
Debug.WriteLine("User: {0}, Tweet: {1}", tweet.User.ScreenNameResponse, tweet.Text);
}
}
부 : 검색이 실행되고 var에 searchResponse에 투입 될 때
{System.NullReferenceException: Object reference not set to an instance of an object
at LinqToTwitter.TwitterQueryProvider+<ExecuteAsync>d__6`1[System.Collections.Generic.IEnumerable`1[LinqToTwitter.Search]].MoveNext() [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [0x0000b] in [somepath]/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Object].GetResult() [0x00034] in [somepath]/System.Runtime.CompilerServices/ConfiguredTaskAwaitable_T.cs:62
at LinqToTwitter.TwitterExtensions+<ToListAsync>d__11`1[LinqToTwitter.Search].MoveNext() [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [0x0000b] in [somepath]/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.TaskAwaiter`1[System.Collections.Generic.List`1[LinqToTwitter.Search]].GetResult() [0x00034] in [somepath]/System.Runtime.CompilerServices/TaskAwaiter_T.cs:59
at [somepath].TwitterService+<GetTweets>d__2.MoveNext() [0x0014f] in [somepath]\TwitterService.cs:27 }
오류가 발생합니다. 나는 인증이 성공했고 bearertoken이 설정되었음을 확인했다. LINQ to Twitter Project site on Codeplex에 Joe Mayo 자신이 제공 한 간단한 예제 이외에는 멋진 내용이 없습니다.
나는 트위트 목록 수신까지 (같은 자격 증명으로) 작동하는 LinqToTwitter를 사용하지 않고 무언가를 시도했지만 LinqToTwitter로 이동하기 위해 선택한 직렬화 이유 때문에.
토큰을 설정하거나 어딘가에 권한을 부여하는 것과 같이 여기에서 분명한 뭔가를 놓치고있는 것처럼 느껴지지만 찾을 수 없습니다. codeplex의 소스 파일에 포함 된 데모 콘솔 프로젝트는 완벽하게 작동하는 것 같습니다. 어떤 아이디어가 있습니까?
아무거나, 누구? 여전히 유효! – Hutjepower