CrossGeeks / FacebookClientPlugin

Facebook Client Plugin for Xamarin iOS and Android
MIT License
106 stars 32 forks source link

FB App closes and crashes our app. #70

Open rod-gp opened 4 years ago

rod-gp commented 4 years ago

Hi, We are having a problem in iOS when the Facebook App is installed. when the login with Facebook button is clicked, the Webview pops up and then an alert asks if you want to login with the App. if you say yes, the app is opened, the user enters the info and hit submit and the user is verified correctly, unfortunately, after all this happens and the Facebook app closes and our app is reopened again our app crashes.

The error on the console is that the application cannot be found.

The question here is ... is there a way to force the webview to NOT prompt the user to open the App? if the app is not present, the webview works like a charm.

we are doing the following

public async Task FacebookLogin() { try { CrossFacebookClient.Current.Logout(); _socialMediaType = Strings.LoginTypeFacebook; var _settings = new JsonSerializerSettings(); _settings.NullValueHandling = NullValueHandling.Ignore;

            var response = await CrossFacebookClient.Current.RequestUserDataAsync(new string[] { "email", "first_name", "gender", "last_name", "birthday" }, new string[] { "email", "user_birthday" });

            if (response.Status == FacebookActionStatus.Completed)
            {
                FBCompleteUserData userData = JsonConvert.DeserializeObject<FBCompleteUserData>(response.Data, _settings);
                _socialMediaUser = new SocialMediaUser()
                {
                    AuthToken = CrossFacebookClient.Current.ActiveToken,
                    Birthday = DateTime.Now,
                    Email = userData.email,
                    LastName = userData.last_name,
                    Name = userData.first_name
                };
                await RunSafe(LoginOrRegister());
            }
            else
            {
                await _popupMessageService.WarningMessage("An error has ocurred, try again later.", "Accept");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
        }
    }
rdelrosario commented 4 years ago

You made sure to do all the steps in https://github.com/CrossGeeks/FacebookClientPlugin/blob/master/docs/iOSSetup.md ?

You configured Entitlement.plist as specified?

rod-gp commented 4 years ago

yes we did, we updated the entitlement, we override the methods and checked it twice in two different environments with the same result.. :(

is there any configuration on the nugget to avoid opening the Facebook app and always remain on the webView?

thanks for the quick response..

rdelrosario commented 4 years ago

You need to update the plugin code to be able to force that there's no way to do it in the current version.

On Wed, May 13, 2020, 11:44 AM rod-gp notifications@github.com wrote:

yes we did, we updated the entitlement, we override the methods and checked it twice in two different environments with the same result.. :(

is there any configuration on the nugget to avoid opening the Facebook app and always remain on the webView?

thanks for the quick response..

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CrossGeeks/FacebookClientPlugin/issues/70#issuecomment-628076833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATOAJ764DT64QADLIGJQHLRRK55ZANCNFSM4M7N34JA .

juans9797 commented 4 years ago

We are having the same issue. The app crashes on some devices, we have tested it on 8 different iPhones and 5 of them work correctly but 3 of them crashes without any error trace. The iPhones are a variety of models, no pattern there. I wouldn't think it is a configuration issue since it actually works on different iPhones. Any ideas?

LeonardoAlfonso88 commented 4 years ago

We have the same issue. We tested in 9 devices, and in 6 work fine, in the other three crash and close the app. Can you help us, please?