iOS SPM Support

Swift Package Manager support for Firebase Apple SDK dependencies (required for Firebase Apple SDK 13+): requirements, dynamic linkage, Expo configuration, the rnfirebase_* Podfile fallbacks, sharing FirebaseCore with other native pods, and troubleshooting.

iOS SPM Support

Prerequisites

  • @react-native-firebase/app installed (and any other @react-native-firebase/* packages you use). Complete Getting Started so GoogleService-Info.plist / Expo googleServicesFile and FirebaseApp.configure() (React Native CLI) are in place.
  • React Native 0.75 or newer (spm_dependency).
  • Xcode >= 26.2 when using firebase-ios-sdk 12.12.0 or newer (v27 pins firebase-ios-sdk 13.1.1).
  • Expo projects: use config plugins (expo-build-properties, @react-native-firebase/app); do not hand-edit a generated ios/Podfile if Expo regenerates it on prebuild.

React Native Firebase resolves its Firebase Apple SDK dependencies with Swift Package Manager (SPM). This changes only how the native Firebase SDK is installed; your JavaScript and native application code do not change.

Firebase Apple SDK 13.0.0 and later are no longer distributed through CocoaPods. The last CocoaPods release is 12.19.3. See Google's CocoaPods deprecation guide.

Requirements and defaults

  • React Native 0.75 or newer is required (spm_dependency).
  • v27 is SPM-only. SPM is the only supported Firebase install path.
  • $RNFirebaseDisableSPM = true and Expo ios.disableSPM: true fail pod install / prebuild. They do not install CocoaPods Firebase 13 pods.
  • SPM requires CocoaPods 1.10 or newer for the React Native pod integration. React Native 0.75+ templates already satisfy this requirement.
  • SPM pins the Firebase iOS SDK to the exact version in sdkVersions.ios.firebase in @react-native-firebase/app (currently 13.1.1).

SPM requires dynamic framework linkage. Edit ios/Podfile before pod install:

ruby
# File: ios/Podfile. Top level, after prepare_react_native_project! and before the app target block. Required for SPM mode. Run pod install after editing.
use_frameworks! :linkage => :dynamic

Do not use RNFB's SPM mode with use_frameworks! :linkage => :static. A Podfile with no use_frameworks! line (or use_frameworks! false) is static linkage too — that is the stock React Native / bare Expo default. firebase-ios-sdk SPM products are automatic libraries (plain .library(...), not type: .dynamic), so each pod that depends on them embeds its own copy. With static pod linkage those copies collide at link time as duplicate-symbol errors. pod install fails fast for that combination instead of surfacing the linker failure later. Dynamic linkage is required for SPM mode to build and run; see Sharing FirebaseCore with other native pods for what dynamic linkage does and does not give you.

Google Sign-In caveat

Firebase Apple SDK 13 depends on App Check 12. GoogleSignIn and Firebase 13 in the same app can fail App Check resolution until GoogleSignIn (and any React Native wrapper that pins it) allow App Check 12. The SPM and CocoaPods paths are separate:

  • SPM: Tagged GoogleSignIn 10.0.0 still declares App Check from: "11.0.0" (11.x). google/GoogleSignIn-iOS #626 (merged on main) widens the SPM App Check range to 11.0.0 ..< 13.0.0. That change is not in a tagged release yet. An SPM resolve can succeed only after a GoogleSignIn tag that includes #626 (or an equivalent App Check 12-capable SPM range).
  • CocoaPods: The GoogleSignIn podspec on main and in 10.0.0 still declares AppCheckCore ~> 11.0. #626 did not change the CocoaPods dependency. CocoaPods graphs that pull GoogleSignIn alongside Firebase 13 stay blocked until a podspec bump allows App Check 12 and @react-native-google-signin/google-signin (or your Podfile pin) picks up that release.

Track GoogleSignIn-iOS releases and the React Native Google Sign-In package for both paths. SPM progress alone does not unblock CocoaPods consumers.

Expo projects

Expo projects must select dynamic linkage with expo-build-properties. Write this into app.json / app.config.js before npx expo prebuild:

json
// File: app.json (or app.config.js). Apply before npx expo prebuild. Sets iOS useFrameworks for SPM (dynamic).
{
  "expo": {
    "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "dynamic"
          }
        }
      ]
    ]
  }
}

Do not pass disableSPM: true to the @react-native-firebase/app config plugin. Firebase 13+ is SPM-only and that option fails prebuild.

The sections below describe editing ios/Podfile directly for React Native CLI projects. Do not follow Podfile edits in an Expo project -- Expo regenerates ios/Podfile from your config plugins on every prebuild, so a direct edit does not persist. Use expo-build-properties instead, as shown above.

Use SPM (React Native CLI)

For React Native 0.75 or newer, SPM is selected automatically. Configure dynamic linkage in your ios/Podfile, then install pods:

ruby
# File: ios/Podfile. Top level, after prepare_react_native_project! and before the app target block. Step 1 of 2 for SPM (React Native CLI).
use_frameworks! :linkage => :dynamic
bash
# Project root / ios/. Step 2 of 2 for SPM (after Podfile use_frameworks! :linkage => :dynamic).
cd ios
pod install

The install output identifies the selected mode:

text
[react-native-firebase] RNFBApp: Using SPM for Firebase dependency resolution (products: FirebaseCore, FirebaseInstallations)

RNFB also adds an [RNFB] Embed Firebase SPM Frameworks build phase to the app target. This phase embeds Firebase frameworks built by SPM that React Native's pod-level SPM integration does not otherwise copy into the app bundle.

Release build and module-resolution settings

RNFB automatically applies two build settings needed for SPM + dynamic linkage, on every pod install/pod update:

  • -ObjC in the app target's linker flags and on RNFB pod targets, so Release's dead-code stripping does not drop Firebase's FIRLibrary/FIRComponent registration or Measurement Objective-C categories statically absorbed into RNFBAnalytics.
  • SWIFT_ENABLE_EXPLICIT_MODULES = 'NO' and CLANG_ENABLE_EXPLICIT_MODULES = 'NO' on both the app project and the Pods project, so Xcode 26's explicit Swift and Clang modules don't fail to resolve Firebase's internal-only SPM targets (FirebaseCoreInternal, FirebaseSharedSwift) or @imports of Firebase modules in your own Objective-C/Objective-C++ files. This does not disable SPM -- it makes Swift and Clang use implicit module discovery across the app, CocoaPods, and SPM build boundary.

You do not need to configure either of these yourself. If pod install warns that they could not be applied automatically, or if Xcode still reports that a Firebase module cannot be resolved, add the fallback in your existing post_install block in ios/Podfile, after react_native_post_install, then re-run pod install:

ruby
# File: ios/Podfile. Fallback only when pod install warns SPM build settings were not applied. Place after react_native_post_install, then pod install.
post_install do |installer|
  react_native_post_install(
    installer,
    config[:reactNativePath],
    # your existing options
  )

  rnfirebase_apply_spm_build_settings(installer)
end

Framework-embedding fallback

RNFB normally installs its SPM framework-embedding phase automatically after CocoaPods has integrated [CP] Embed Pods Frameworks into the app target (post_integrate). If pod install warns that automatic embedding could not be configured, call the documented fallback from post_integrate in ios/Podfile, then re-run pod install:

ruby
# File: ios/Podfile. Fallback only when pod install warns SPM embed phase was not configured. Then pod install.
post_integrate do |installer|
  rnfirebase_add_spm_embed_phase(installer)
end

Do not add the fallback unless the warning appears or the generated app target does not contain [RNFB] Embed Firebase SPM Frameworks.

Sharing FirebaseCore with other native pods

React Native attaches SPM products to each pod target via spm_dependency. Because firebase-ios-sdk products are automatic libraries, each dynamic pod framework that depends on Firebase embeds its own copy of FirebaseCore. FirebaseApp.configure() in the app configures only the copy that target links. Another pod's copy is never configured, so FirebaseApp.app() can return nil there (and Auth can silently look signed-out even when RNFB JS Auth has a user).

RNFBOther native dependencyShared FirebaseCore?
SPMSPM (spm_dependency)No: each dynamic pod embeds its own copy
SPMCocoaPods Firebase podsNo: dual resolution

CocoaPods Firebase is no longer available for Firebase 13+. If a third-party native module must share one configured FirebaseApp with RNFB, that module must also resolve Firebase via SPM (same exact SDK version), not CocoaPods trunk. Do not mix RNFB SPM with a third-party pod that still pulls Firebase via CocoaPods. That is dual resolution and does not produce one shared runtime.

Static pod linkage is not a sharing workaround under SPM: it fails at link time with duplicate symbols (and pod install rejects the combination).

Troubleshooting

  • pod install fails with "Firebase Apple SDK is no longer distributed through CocoaPods": Remove $RNFirebaseDisableSPM = true and Expo ios.disableSPM. Use use_frameworks! :linkage => :dynamic and React Native 0.75+.
  • pod install fails with "SPM + static linkage is not supported": Use dynamic linkage (use_frameworks! :linkage => :dynamic). A Podfile with no use_frameworks! line (or use_frameworks! false), the stock React Native / Expo default, is static linkage too.
    • With the stock template Podfile, USE_FRAMEWORKS=dynamic pod install also works, but it must be set for every pod install (including CI); the Podfile line is the durable fix.
    • Expo: set ios.useFrameworks to "dynamic" in the expo-build-properties plugin (see Expo projects), then re-run npx expo prebuild. Only if you maintain ios/ by hand (no prebuild), set "ios.useFrameworks": "dynamic" in ios/Podfile.properties.json instead.
  • FirebaseApp.app() is nil / Auth looks signed-out inside another native pod, or runtime logs duplicate FIRApp classes: SPM mode cannot share one FirebaseCore across dynamic pod frameworks. See Sharing FirebaseCore with other native pods.
  • FirebaseCoreInternal/FirebaseSharedSwift cannot be resolved, or a Release/Archive build crashes at launch with a missing Firebase symbol: RNFB applies -ObjC, SWIFT_ENABLE_EXPLICIT_MODULES = 'NO', and CLANG_ENABLE_EXPLICIT_MODULES = 'NO' automatically; call rnfirebase_apply_spm_build_settings(installer) as a fallback only if pod install warns it could not do so.
  • A Firebase framework is missing at app launch: Re-run pod install, check for its automatic-embedding warning, and confirm the app target contains [RNFB] Embed Firebase SPM Frameworks. Use the fallback only when needed.
  • spm_dependency is unavailable: Upgrade to React Native 0.75 or newer.
  • SPM and CocoaPods both produce the same Firebase framework: Remove manually declared Firebase pods/packages so RNFB owns Firebase dependency resolution.

Archive fails with "…xcframework-ios.signature" (or -ios-simulator.signature) "couldn't be copied … because an item with the same name already exists": An Xcode Archive bug with SPM binary xcframeworks (not an RNFB regression). RNFB adds a build phase that removes these files; after upgrading, re-run pod install. If RNFB warns it couldn't add the phase, add a Run Script phase on the app target:

bash
# Only if archive fails with xcframework-*.signature copy conflict and RNFB
# could not apply its automatic workaround. Use the name from the error.
rm -f "${CONFIGURATION_BUILD_DIR}"/<NameFromTheErrorMessage>.xcframework-ios.signature
rm -f "${CONFIGURATION_BUILD_DIR}"/<NameFromTheErrorMessage>.xcframework-ios-simulator.signature