Skip to content

[🐛] 🔥 [runtime not ready]: Error: No Firebase App '[DEFAULT]' has been created - call firebase.initializeApp() [RN -0.78] [iOS only] #8461

Open
@DonovanEnas

Description

@DonovanEnas

Issue

Got this issue while upgrading react native version to 0.78, i have tried cleaning the project, node_modules, yarn cache and Pods and podfile.lock. Also my AppDelegate.swift has import FirebaseCore and FirebaseApp.configure() which i saw were solutions to a similar issue that was reporeted. Could get the app running fine on android.


Project Files

Javascript

Click To Expand

package.json:

{
  "name": "appname",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "lint:fix": "yarn lint -- --fix",
    "format": "prettier --check .",
    "format:fix": "prettier --write .",
    "buildApk": "cd android && ./gradlew clean && ./gradlew assembleRelease && cd ..",
    "postinstall": "patch-package",
    "cleanProject": "watchman watch-del-all && rm -rf yarn.lock package-lock.json node_modules ios/Pods ios/Podfile.lock android/app/build && npm install && cd ios && pod update && cd .. && npm start -- --reset-cache"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "./src/*.js": [
      "yarn format && yarn format:fix && yarn lint"
    ]
  },
  "dependencies": {
    "@gorhom/bottom-sheet": "^5.1.2",
    "@notifee/react-native": "^9.1.8",
    "@react-native-async-storage/async-storage": "^2.0.0",
    "@react-native-camera-roll/camera-roll": "^7.3.0",
    "@react-native-clipboard/clipboard": "^1.16.0",
    "@react-native-community/cli": "15.0.1",
    "@react-native-community/cli-platform-android": "15.0.1",
    "@react-native-community/cli-platform-ios": "15.0.1",
    "@react-native-community/datetimepicker": "^8.0.0",
    "@react-native-community/geolocation": "^3.4.0",
    "@react-native-community/netinfo": "^11.3.3",
    "@react-native-firebase/app": "^21.13.0",
    "@react-native-firebase/crashlytics": "^21.13.0",
    "@react-native-firebase/messaging": "^21.13.0",
    "@react-native-picker/picker": "^2.4.1",
    "@react-native/babel-preset": "^0.78.0",
    "@react-navigation/bottom-tabs": "^7.3.3",
    "@react-navigation/drawer": "^7.3.2",
    "@react-navigation/elements": "^2.3.1",
    "@react-navigation/material-top-tabs": "^7.2.3",
    "@react-navigation/native": "^7.0.19",
    "@react-navigation/stack": "^6.3.21",
    "@rematch/core": "^2.2.0",
    "@rematch/loading": "^2.1.2",
    "@rematch/persist": "^2.1.2",
    "accordion-collapse-react-native": "^1.1.1",
    "axios": "^1.8.4",
    "axios-retry": "^4.5.0",
    "babel-eslint": "^10.1.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "eslint-plugin-prettier": "^5.2.5",
    "eslint-plugin-react-native": "^4.0.0",
    "jwt-decode": "3.1.2",
    "lodash.debounce": "^4.0.8",
    "lodash.groupby": "^4.6.0",
    "moment": "^2.29.3",
    "patch-package": "^8.0.0",
    "payu-non-seam-less-react": "^3.3.0",
    "query-string": "^8.1.0",
    "react": "19.0.0",
    "react-content-loader": "^6.2.1",
    "react-hook-form": "^7.49.3",
    "react-native": "^0.78.0",
    "react-native-app-auth": "^6.4.3",
    "react-native-calendars": "^1.1284.0",
    "react-native-camera": "^4.2.1",
    "react-native-country-flag": "^2.0.2",
    "react-native-country-picker-modal": "^2.0.0",
    "react-native-device-info": "^10.12.0",
    "react-native-drop-shadow": "^1.0.0",
    "react-native-fs": "^2.18.0",
    "react-native-gesture-handler": "^2.24.0",
    "react-native-get-random-values": "^1.8.0",
    "react-native-iap": "^12.10.5",
    "react-native-image-crop-picker": "^0.42.0",
    "react-native-image-picker": "^8.2.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-localize": "^3.4.1",
    "react-native-maps": "^1.20.1",
    "react-native-modal": "^14.0.0-rc.1",
    "react-native-modal-datetime-picker": "^18.0.0",
    "react-native-otp-entry": "^1.8.2",
    "react-native-pager-view": "^6.7.0",
    "react-native-paper": "5.1.3",
    "react-native-permissions": "3.3.1",
    "react-native-phone-input": "^1.3.3",
    "react-native-popup-menu": "^0.16.1",
    "react-native-qrcode-svg": "^6.1.2",
    "react-native-reanimated": "^3.17.2",
    "react-native-reanimated-carousel": "^3.1.5",
    "react-native-safe-area-context": "^5.3.0",
    "react-native-screens": "^4.9.2",
    "react-native-share": "^12.0.9",
    "react-native-simple-toast": "^3.2.0",
    "react-native-slider": "^0.11.0",
    "react-native-sound-player": "^0.14.5",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^15.11.2",
    "react-native-switch-selector": "^2.3.0",
    "react-native-tab-view": "^3.1.1",
    "react-native-toast-message": "^2.1.5",
    "react-native-url-polyfill": "^2.0.0",
    "react-native-version-info": "^1.1.1",
    "react-native-webview": "^13.13.1",
    "react-redux": "8.0.2",
    "redux": "^4.2.0",
    "update": "^0.7.4",
    "uuid": "^9.0.0",
    "victory-native": "^36.6.8"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.23.8",
    "@babel/runtime": "^7.23.8",
    "@react-native/babel-preset": "^0.78.0",
    "@react-native/eslint-config": "^0.73.2",
    "@react-native/metro-config": "^0.78.0",
    "@react-native/typescript-config": "0.74.0",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "lint-staged": "^15.2.0",
    "metro": "^0.82.1",
    "metro-config": "^0.82.1",
    "prettier": "3.2.2",
    "react-native-svg-transformer": "^1.0.0",
    "react-test-renderer": "19.0.0",
    "redux-persist": "^6.0.0",
    "typescript": "5.1.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!


linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym # For Firebase
end

target 'AppName' do
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'RNIap', :path => '../node_modules/react-native-iap'
  pod 'TrustKit'
  config = use_native_modules!
  use_frameworks! :linkage => :static 
  $RNFirebaseAsStaticFramework = true
  flags = get_default_flags()
  
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'nanopb', :modular_headers => true
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  pod 'Firebase/Crashlytics'
  pod 'Firebase/Analytics'
  pod 'react-native-google-maps', :path => '../node_modules/react-native-maps' # This script is for the google maps if not needed then please skip this one
  # <--- FCM(Firebase push notification) setup scripts End 
  
  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end
end

AppDelegate.swift:

import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import RNBootSplash 
import FirebaseCore // ⬅️ this
import FirebaseMessaging

@main
class AppDelegate: RCTAppDelegate {
  override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    self.moduleName = "AppName"
    self.dependencyProvider = RCTAppDependencyProvider()

    // You can add your custom initial props in the dictionary below.
    // They will be passed down to the ViewController used by React Native.
    self.initialProps = [:]
    FirebaseApp.configure() // ⬅️ this
    Messaging.messaging().delegate = self
    application.registerForRemoteNotifications()

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }

  // ⬇️ override this method
  override func customize(_ rootView: RCTRootView!) {
    super.customize(rootView)
    RNBootSplash.initWithStoryboard("BootSplash", rootView: rootView) // ⬅️ initialize the splash screen
  }
  override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
  Messaging.messaging().apnsToken = deviceToken
  }
  // Add the following function if needed (for firebase)
// MARK: - MessagingDelegate
  extension AppDelegate: MessagingDelegate {
    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
        // // Send token to your server if needed
        if let token = fcmToken {
            let dataDict: [String: String] = ["token": token]
            NotificationCenter.default.post(
                name: Notification.Name("FCMToken"),
                object: nil,
                userInfo: dataDict
            )
        }
    }
  }
}

Environment

Click To Expand

react-native info output:

 System:
  OS: macOS 15.3.2
  CPU: (10) x64 Apple M4
  Memory: 36.07 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.10.0
    path: ~/.nvm/versions/node/v23.10.0/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.2
    path: ~/.nvm/versions/node/v23.10.0/bin/npm
  Watchman:
    version: 2025.03.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.12816248
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /usr/bin/javac
  Ruby:
    version: 3.2.0
    path: /.rvm/rubies/ruby-3.2.0/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.78.2
    wanted: ^0.78.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • 21.13.0
  • Firebase module(s) you're using that has the issue:
    • e.g. crashlytics, messaging
  • Are you using TypeScript?
    • N

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions