Skip to content

[iOS][New Architecture] Build fails with "Type specifier missing" and "Declaration of RCTBridgeModule must be imported" in Firestore and Storage#9048

Description

@Foris-master

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch @react-native-firebase/firestore@24.1.0 for the project I'm working on.

When building an iOS project with the New Architecture enabled (-DRCT_NEW_ARCH_ENABLED=1) alongside app, firestore, and storage, the Xcode build fails completely.

Because Firestore relies on heavy C++ libraries (like gRPC and abseil), forcing static frameworks (use_frameworks! :linkage => :static) causes the Libtool archiver to crash with a nonzero exit code.

To avoid the C++ crash, we must switch to Dynamic Frameworks (use_frameworks! :linkage => :dynamic). However, doing this forces strict module maps, which exposes a source-code bug: Several Objective-C files in RNFBFirestore and RNFBStorage are missing the #import <React/RCTBridgeModule.h> header.

Errors Encountered:
Depending on the build phase, Xcode throws these specific fatal errors:

Declaration of 'RCTBridgeModule' must be imported from module 'RNFBApp.RNFBAppModule' before it is required

Include of non-modular header inside framework module

Type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int alongside Expected ')'.

Files Affected:
The compiler halts on the following files because they utilize React Native macros without importing the core bridge header:

node_modules/@react-native-firebase/firestore/ios/RNFBFirestore/RNFBFirestoreCollectionModule.m

node_modules/@react-native-firebase/firestore/ios/RNFBFirestore/RNFBFirestoreCommon.h

node_modules/@react-native-firebase/firestore/ios/RNFBFirestore/RNFBFirestoreModule.h

node_modules/@react-native-firebase/firestore/ios/RNFBFirestore/RNFBFirestoreModule.m

node_modules/@react-native-firebase/firestore/ios/RNFBFirestore/RNFBFirestoreDocumentModule.m

node_modules/@react-native-firebase/storage/ios/RNFBStorage/RNFBStorageModule.m

The Workaround / Solution:
To get the project to compile, I had to implement a two-part fix:

Podfile Adjustments:
Switch to dynamic frameworks and explicitly allow non-modular includes so the core React headers don't trigger strict module violations.

Ruby
use_frameworks! :linkage => :dynamic

Inside post_install:

installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
end
end
Source Code Patches:
Used patch-package to manually inject #import <React/RCTBridgeModule.h> at the very top of all the affected .m and .h files listed above.

Expected Behavior:
The iOS modules for Firestore and Storage should successfully compile out-of-the-box under the New Architecture with Dynamic Frameworks, without requiring manual header injections via patch-package.

Environment:

React Native version: 0.85

@react-native-firebase/app version: 24.1.0

@react-native-firebase/firestore version: 24.1.0

New Architecture Enabled: true

iOS deployment target: react native 0.85 min ios targert

This issue body was partially generated by patch-package.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions