Firebase iphone simulator pair to mac is not working and returning null Xamarin

wedad gamal 1 Reputation point
2022-03-13T18:59:11.42+00:00

Why Firebase.Auth.Auth.DefaultInstance is returning Null?

I'm using xamarin iphone simulator by pair to mac

First, When I tried to sign in using my Apple ID, it returns a warning after selecting my team "There are no current IOS devices on this team matching the provided device IDs"

Second, When I set custom entitlements manually, it returns compile error "Could not find any available provisioning profiles for TravelRecordApp.iOS on iOS"

Third, When I am not set custom entitlements, it returns null when calling Firebase.Auth.Auth.DefaultInstance to create user

await Firebase.Auth.Auth.DefaultInstance.CreateUserAsync(email, password);

my steps: Add "Xamarin.Firebase.iOS.Auth" NuGet package to iOS project Import "GoogleService-Info.plist" and set the building action to "BundleResource" Make sure that my bundle identifier is identical to the bundle identifier inside "GoogleService-Info.plist" Add the next line of code in the AppDelegate.cs FinishedLaunching before LoadApplication: Firebase.Core.App.Configure();

Note I am using visual studio 2022

Please advice.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,305 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 27,126 Reputation points Microsoft Vendor
    2022-03-14T06:08:55.207+00:00

    Hello @wedad gamal ,

    Firebase.Auth.Auth.DefaultInstance being Null indicates an issue configuring the Firebase SDK in the app. Try to check if you forget to import Firebase.Core namespace in AppDelegate (sometimes build without error if you don't add this namespace).
    You can use Firebase Authentication to allow users to sign in to your app using one or more sign-in methods, including email address and password sign-in, and federated identity providers such as Google Sign-in and Facebook Login. But this line of code await Firebase.Auth.Auth.DefaultInstance.CreateUserAsync(email, password); means you are using email address and password sign-in. You may also need to send a user a verification email. For more details, refer to https://github.com/xamarin/GoogleApisForiOSComponents/blob/main/docs/Firebase/Auth/GettingStarted.md

    About your first and second issue, it is related to Manual provisioning for Xamarin.iOS, go to Tools -> Options->Xamarin ->Apple Account, choose your Apple ID, click View Details to check your certificates and profiles.
    Automatic Provisioning is also a great choice(your third step).

    In addition, you could check if your VS(Windows and Mac) and Xcode need to be updated.

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.