Я создал функцию для входа в систему с помощью Facebook.Xamarin.Auth OAuth2Authenticator Facebook NullReferenceException
public void Login()
{
var ctx = Forms.Context as MainActivity;
var accounts =
new List<Account>(AccountStore.Create (ctx).FindAccountsForService (SERVICE));
if (accounts.Count == 1) {
GetAccount (accounts [0]);
return;
}
var auth = new OAuth2Authenticator (
clientId: FBID,
scope: string.Empty,
authorizeUrl: new Uri (AUTH_URL),
redirectUrl: new Uri (REDIRECT_URL));
auth.Completed += (sender, eventArgs) => {
AccountStore.Create (ctx).Save (eventArgs.Account, "Facebook");
GetAccount (eventArgs.Account);
};
ctx.StartActivity (auth.GetUI (ctx));
}
Дело в том, что после того как я ввожу свои учетные данные на странице входа в систему FB, создается исключение, прежде чем он достигнет Completed
событие.
Я загрузил проект Xamarin.Auth от GitHub, пытаясь отладить программу, но, к сожалению, она не сломается на контрольной точке.
Caused by: JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Auth.OAuth2Authenticator.OnRetrievedAccountProperties (System.Collections.Generic.IDictionary`2) [0x00017] in d:\Downloads\Xamarin.Auth-master\Xamarin.Auth-master\src\Xamarin.Auth\OAuth2Authenticator.cs:373
at Xamarin.Auth.OAuth2Authenticator.OnRedirectPageLoaded (System.Uri,System.Collections.Generic.IDictionary`2,System.Collections.Generic.IDictionary`2) [0x00016] in d:\Downloads\Xamarin.Auth-master\Xamarin.Auth-master\src\Xamarin.Auth\OAuth2Authenticator.cs:282
at Xamarin.Auth.WebRedirectAuthenticator.OnPageEncoun...[intentionally cut off]
Я сейчас борюсь с этой проблемой. Пожалуйста помоги!
возможно дубликат [? Что такое NullReferenceException и как это исправить] (http://stackoverflow.com/questions/4660142/what-is- а-NullReferenceException-и-как-делать-я-Fix-It) –