GoogleApisForiOSComponents icon indicating copy to clipboard operation
GoogleApisForiOSComponents copied to clipboard

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

Open AdamBebko opened this issue 3 years ago • 1 comments

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

AdamBebko avatar Mar 29 '22 04:03 AdamBebko

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

BierDav avatar Feb 05 '23 15:02 BierDav