CrossGeeks / FacebookClientPlugin

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

browser opens and closes with no error #76

Closed unixbob closed 4 years ago

unixbob commented 4 years ago

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 2.2.1 Device Tested On: Pixel 3 / iPhone 6s Simulator Tested On: iPhone 11 emulator Version of VS: 8.6 build 4520 (Mac) Version of Xamarin: 4.6 Versions of other things you are using:

Steps to reproduce the Behavior

I've used the code at https://www.xamboy.com/2019/11/19/social-media-authentication-google-login-in-xamarin-forms/ as a base and integrated into my app.

I can build the Android version of my app and it can open both the FacebookClientPlugin and the GoogleClientPlugin

The iOS version of the app builds fine. When I run the app it pops up a dialog box saying '"Feelix" wants to use "Facebook.com" to SignIn'. If I click continue it opens a browser window which then disappears. The GooglePlugin has exactly the same behaviour.

I've copied the config from Rendy's SocialMediaLogin app and swapped for my app / bundle Id's. so I think my info.plist and entitlement.plist is correct.

I can build Rendy's app and that works fine on iOS. so I think my build environment is correct.

It works on Android so I think my fork of Rendy's code works correctly.

Because I get the same behaviour on both the FacebookPlugin and the GooglePlugin, it doesn't seem like a plugin config issue, but either a dependent plugin issue, or something to do with the iOS environment. But I have checked a number of things.

so wondering whether you have seen this behaviour before, or have any thought?

Expected Behavior

Plugin requests permission and then takes you to the Facebook login page to login in and get account info

Actual Behavior

Plugin requests permission, opens another window that then disappears without anything in the debug log in Xamarin

Code snippet

https://www.xamboy.com/2019/11/19/social-media-authentication-google-login-in-xamarin-forms/

Screenshotst

Kapusch commented 4 years ago

Hi @unixbob , can you please explain how did you fix this issue ?

I'm currently experiencing the exact same behaviour (Google & FB Sign In), and I remember that everything worked well before.

Kapusch commented 4 years ago

I've finally succeed to isolate the code that was causing the modal disappearing.

For the record, every time the Sign In modal appears, it triggers a call to the method "OnResume" from App.xaml.cs, and in my case, I was requesting a page refresh that causes the modal disappearing.

I will spend time to better understand the Xamarin App Life cycle in order to fix my bug : https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/app-lifecycle