Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using remote config with custom Firebase app throws NullPointerException on iOS #707

Open
jimmymorales opened this issue Feb 24, 2025 · 0 comments

Comments

@jimmymorales
Copy link

Running

      val app = Firebase.app("ExampleApp")
      Firebase.remoteConfig(app)

throws:

kotlin.NullPointerException
    at 0   CoraSDK                             0x105c38c2b        kfun:kotlin.Throwable#<init>(){} + 75 
    at 1   CoraSDK                             0x105c32adf        kfun:kotlin.Exception#<init>(){} + 67 
    at 2   CoraSDK                             0x105c32caf        kfun:kotlin.RuntimeException#<init>(){} + 67 
    at 3   CoraSDK                             0x105c32e7f        kfun:kotlin.NullPointerException#<init>(){} + 67 
    at 4   CoraSDK                             0x105c655e7        ThrowNullPointerException + 127 
    at 5   CoraSDK                             0x105eda10b        kfun:dev.gitlive.firebase#<get-app>__at__dev.gitlive.firebase.Firebase(){}dev.gitlive.firebase.FirebaseApp + 355 
    at 6   CoraSDK                             0x105f82e87        kfun:dev.gitlive.firebase.remoteconfig#remoteConfig__at__dev.gitlive.firebase.Firebase(dev.gitlive.firebase.FirebaseApp){}dev.gitlive.firebase.remoteconfig.FirebaseRemoteConfig + 331 
    at 7   CoraSDK                             0x105afe71f  

This is only occurring for the iOS implementation and the reason is that when creating the Remote Config instace the default app is being used instead of the custom one, in the case where the default one doesn't existing it throws.

In FirebaseRemoteConfig.kt line 30, instead of doing this:

public actual fun Firebase.remoteConfig(app: FirebaseApp): FirebaseRemoteConfig = FirebaseRemoteConfig(
    FIRRemoteConfig.remoteConfigWithApp(Firebase.app.ios as objcnames.classes.FIRApp),
)

It should be:

public actual fun Firebase.remoteConfig(app: FirebaseApp): FirebaseRemoteConfig = FirebaseRemoteConfig(
    FIRRemoteConfig.remoteConfigWithApp(app.ios as objcnames.classes.FIRApp),
)

If PRs are welcomed, I'm more than happy to create one for this simple fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant