xamarin / GoogleApisForiOSComponents

MIT License
225 stars 161 forks source link

Xamarin.Firebase.iOS.Auth 8.10.0 has Auth.DefaultInstance always null, downgrading to 6.9.2 fixes it #541

Open AdamBebko opened 2 years ago

AdamBebko commented 2 years ago

I am fairly new to this so pardon me if I'm missing something obvious. I am building up a Xamarin App using Xamarin.Firebase.iOS.Auth v8.10.0, and my signing method is throwing null reference errors because Auth.DefaultInstance is always null. All Xamarin.Firebase.iOS packages were 8.10.0.

The exact same code works fine when I downgraded all Xamarin.Firebase.iOS packages to 6.9.x.

here is the code in question:

        public async Task<string> LoginAsync(string userName, string password)
        {

            if (Auth.DefaultInstance == null)
            {

                // THIS ALWAYS HAPPENS in v8.10.0, not 6.9.2

                Console.WriteLine("null auth instance");
                return string.Empty;
            }

            AuthDataResult user = await Auth.DefaultInstance.SignInWithPasswordAsync(userName, password);
            string token = await user.User.GetIdTokenAsync();
            return token;
        }

Here are the nugget packages in the working version: I only downgraded the Xamarin.Firebase.iOS packages. to make it work

image

BierDav commented 1 year ago

Same Behavior for Xamarin.Firebase.iOS.Core (App.DefaultInstance), Xamarin.Firebase.iOS.CloudMessaging (Messaging.SharedInstance). I think that's correlated.