GitLiveApp / firebase-kotlin-sdk

A Kotlin-first SDK for Firebase
https://gitliveapp.github.io/firebase-kotlin-sdk/
Apache License 2.0
1.1k stars 154 forks source link

Auth crash when checking if user is Email-Verified #619

Open Tommyten opened 2 weeks ago

Tommyten commented 2 weeks ago

When checking if a user is email verified using Firebase auth the app crashes with the following message: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRUser emailVerified]: unrecognized selector sent to instance 0x600002c16800'

The setup is pretty simple. With a logged in user I execute this piece of code:

Napier.e("About to crash")
Firebase.auth.currentUser?.let {
    Napier.e("Did get current User")
    val mailVerified = it.isEmailVerified
    Napier.e("Unreachable on iOS | mailVerified: $mailVerified")
}

on iOS it leads to a crash; on Android it doesn't. I didn't test any other platforms yet. This crash only came up, after upgrading gitlive firebase auth from version 1.12.0 to 2.1.0

nbransby commented 2 weeks ago

@siarhei-luskanau is this likely to be caued by https://github.com/GitLiveApp/firebase-kotlin-sdk/pull/592/files and need to be changed to emailVerified()?

siarhei-luskanau commented 2 weeks ago

@siarhei-luskanau is this likely to be caued by https://github.com/GitLiveApp/firebase-kotlin-sdk/pull/592/files and need to be changed to emailVerified()?

I will have a look

siarhei-luskanau commented 5 days ago

@Tommyten I have tried to reproduce this issue on my project and isEmailVerified works well for me. Please provide more information about issue. I have tested this case there . Anonymous Sign-in provider is used in Firebase web console.

izadiegizabal commented 4 days ago

i don't have a reproducible project to share, but i am also getting this error by accessing AuthState.isEmailVerified since i upgraded to 2.1.0. reverting back to 2.0.0 seems to fix the issue.

siarhei-luskanau commented 4 days ago

2.1.0 version has the commit Updated firebase-cocoapods to "11.1.0". I think it is necessary to update the firebase-ios-sdk dependency version to 11.1.0 in iosApp/iosApp.xcodeproj/project.pbxproj file in ios project.

In my case it looks like:

/* Begin XCRemoteSwiftPackageReference section */
        92C05B532C972C51003DFD70 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
            isa = XCRemoteSwiftPackageReference;
            repositoryURL = "https://github.com/firebase/firebase-ios-sdk";
            requirement = {
                kind = exactVersion;
                version = 11.1.0;
            };
        };
/* End XCRemoteSwiftPackageReference section */
izadiegizabal commented 4 days ago

you are right @siarhei-luskanau! i had to update my pods, it's now fixed :)