Skip to content

[🐛] Bug Report Title - FirebaseApp.configure() not working in React Native 0.79.1 AppDelegate.swift using New Architecture #8506

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

Open
Spero-Sourabh opened this issue Apr 30, 2025 · 1 comment
Labels

Comments

@Spero-Sourabh
Copy link

Spero-Sourabh commented Apr 30, 2025

I'm trying to configure Firebase in a React Native 0.79.1 app using the new architecture. The AppDelegate.swift file format has changed in RN 0.79+, and FirebaseApp.configure() does not seem to initialize Firebase properly when added to this file.

Environment:

React Native version: 0.79.1

Firebase module: @react-native-firebase/app (or whatever module you're using)

macOS version:15.2

Xcode version: 16.0

Cocoapods version: 1.16.2

iOS deployment target: ios 18

Steps to reproduce:

Install Firebase via CocoaPods.

Add FirebaseApp.configure() to AppDelegate.swift.

Run the app using yarn ios.

Expected behavior: Firebase should initialize successfully without errors.

Actual behavior: Firebase is not initialized, or no logs confirm that FirebaseApp.configure() ran successfully. Sometimes other Firebase modules throw "not configured" errors.

AppDelegate.swift Code:

import UIKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import FirebaseCore

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
  var window: UIWindow?

  var reactNativeDelegate: ReactNativeDelegate?
  var reactNativeFactory: RCTReactNativeFactory?

  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {

    FirebaseApp.configure()

    let delegate = ReactNativeDelegate()
    let factory = RCTReactNativeFactory(delegate: delegate)
    delegate.dependencyProvider = RCTAppDependencyProvider()

    reactNativeDelegate = delegate
    reactNativeFactory = factory

    window = UIWindow(frame: UIScreen.main.bounds)

    factory.startReactNative(
      withModuleName: "skyzone",
      in: window,
      launchOptions: launchOptions
    )

    return true
  }
}

Additional context: I've verified the GoogleService-Info.plist file is added to the correct target. I’ve also confirmed that Firebase is installed via pod install. No compile-time errors are present, but Firebase is not functioning as expected.

@mikehardy
Copy link
Collaborator

We see people complaining of this or similar build issues from time to time and it always seems to have a different cause. There are unfortunately a million ways it can go wrong. We are unable to help everyone with every single failure mode, as the support load would be impossible to bear.

What I've got instead is a complete, 100% scripted example of a react-native-firebase integration with the stock react-native template that has comments and starts from scratch (npx @react-native-community/cli init ...) and integrates everything in a scripted way (so you can see exactly what it does, and what the result looks like) and then runs debug and release builds.

It works every time

https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

Read it. Run it. Compare the output with your project. Somewhere in the difference is why your build is failing

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

No branches or pull requests

2 participants