Closed gimkim closed 5 years ago
I am also facing the same issue, while cancel or back from the facebook login, Android app is crashing.
I resolve the issue by first calling the CrossFacebookClient.Current.LoginAsync method and then I check the status, if it is equal to FacebookActionStatus.Completed, then I am calling the CrossFacebookClient.Current.RequestUserDataAsync method. For example
var loginData = await CrossFacebookClient.Current.LoginAsync(new string[] { "email" });
if (loginData.Status == FacebookActionStatus.Completed)
{
var jsonData = await CrossFacebookClient.Current.RequestUserDataAsync(new string[] { "id", "email", "first_name", "last_name", "picture" }, new string[] { "email" });
if (jsonData.Status == FacebookActionStatus.Completed)
{
Debug.WriteLine(jsonData.Data.ToString());
}
}
else
{
Debug.WriteLine(loginData.Message);
}
I had that issue too, because I directly used the LoginAsync method in my logic.
After separating it into a separate task the response comes back an then the model execution continues...
private Plugin.FacebookClient.Abstractions.FacebookResponse<bool> facebookLoginResult; public async Task LoginAsync()
{ facebookLoginResult = await CrossFacebookClient.Current.LoginAsync(new string[] { "email" });
}
Should be fixed in:
https://www.nuget.org/packages/Plugin.FacebookClient/2.0.1-beta
This version is still in beta but almost releasing a stable version once all tests are completed.
If not fixed after testing this beta please re-open
Bug Information
Version Number of Plugin: 1.4.0 Device Tested On: sony xperia x (oreo) Simulator Tested On: android x86 5.1.1 emulator Version of VS: Community 2017 (15.7.5) Version of Xamarin: 3.2.0.729530-pre2 Versions of other things you are using:
Steps to reproduce the Behavior
-call the CrossFacebookClient.Current.RequestUserDataAsync method -facebook login dialog appeared -close the facebook login dialog (or pressing back ) without loggin in -Exception occured in external (plugin) code cause the app to crash
Expected Behavior
-should not crash -should get the result.Status ==Plugin.FacebookClient.Abstractions.FacebookActionStatus.Canceled
Actual Behavior
-Exception occured in external (plugin) code cause the app to crash