Skip to content

Conversation

@MichaelBernhardt
Copy link
Contributor

Summary

Adds DEFINES_MODULE = YES to FirebaseCore, FirebaseInstallations, and FirebaseCoreExtension podspecs to enable module map generation for static framework builds.

Motivation

Swift-based Firebase pods (FirebaseCoreInternal, FirebaseCrashlytics, FirebaseSessions) depend on these Objective-C pods. When using static frameworks (use_frameworks! :linkage => :static), Swift cannot import Objective-C dependencies unless they define modules.

This currently prevents React Native (New Architecture), Expo, and other frameworks from using Firebase with static linking, causing build failures with errors like:

  • The Swift pod X depends upon Y, which does not define modules
  • include of non-modular header inside framework module

Changes

Added 'DEFINES_MODULE' => 'YES' to pod_target_xcconfig in:

  • FirebaseCore.podspec - Added to existing config section
  • FirebaseInstallations.podspec - Added to existing config section
  • FirebaseCoreExtension.podspec - Created new config section

When DEFINES_MODULE is enabled, CocoaPods automatically generates module.modulemap files during pod installation, enabling Swift to import these Objective-C modules in static framework builds.

Testing

All modified podspecs pass CocoaPods validation:

pod spec lint FirebaseCore.podspec --quick --allow-warnings
pod spec lint FirebaseInstallations.podspec --quick --allow-warnings
pod spec lint FirebaseCoreExtension.podspec --quick --allow-warnings

Impact

  • Backward Compatible - No breaking changes to existing projects
  • Enables static frameworks for React Native, Expo, and similar frameworks
  • Smaller app sizes compared to dynamic framework workarounds
  • Standard practice - aligns with modern CocoaPods conventions

Related Issues

This resolves #15249 and addresses issues reported across the ecosystem:

Additional Context

External dependencies (GoogleUtilities, GoogleDataTransport, nanopb) are maintained in separate repositories and would benefit from similar changes. However, this PR resolves the issue for all Firebase-owned Objective-C pods within this repository.


I've tested this change locally and confirmed it resolves the static framework build issues while maintaining full backward compatibility with existing projects using dynamic frameworks.

…ramework compatibility

This commit adds DEFINES_MODULE = YES to the pod_target_xcconfig section of
FirebaseCore, FirebaseInstallations, and FirebaseCoreExtension podspecs.

## Problem
Swift-based Firebase pods (FirebaseCoreInternal, FirebaseCrashlytics, FirebaseSessions)
depend on Objective-C Firebase pods. When using static frameworks via
'use_frameworks! :linkage => :static', Swift cannot import Objective-C dependencies
unless those dependencies define module maps.

This prevents React Native (New Architecture), Expo, and other frameworks from using
Firebase with static linking, resulting in errors like:
- "The Swift pod X depends upon Y, which does not define modules"
- "include of non-modular header inside framework module"

## Solution
Enable module map generation by adding 'DEFINES_MODULE' => 'YES' to the
pod_target_xcconfig in:
- FirebaseCore.podspec
- FirebaseInstallations.podspec
- FirebaseCoreExtension.podspec (new section added)

When DEFINES_MODULE is enabled, CocoaPods automatically generates module.modulemap
files, allowing Swift code to properly import these Objective-C dependencies in
static framework builds.

## Impact
- Enables static framework usage for React Native, Expo, and other frameworks
- Maintains full backward compatibility with existing projects
- No breaking changes - dynamic frameworks continue to work as before
- Aligns with modern iOS build practices and CocoaPods best practices

## Testing
All modified podspecs pass validation:
- pod spec lint FirebaseCore.podspec --quick --allow-warnings
- pod spec lint FirebaseInstallations.podspec --quick --allow-warnings
- pod spec lint FirebaseCoreExtension.podspec --quick --allow-warnings

## Related Issues
Resolves firebase#15249
Related to:
- invertase/react-native-firebase#6933
- invertase/react-native-firebase#6332
- expo/expo#39607

## Note
External dependencies (GoogleUtilities, GoogleDataTransport, nanopb) are maintained
in separate repositories and would benefit from similar changes for complete resolution.
@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@paulb777
Copy link
Member

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds modular headers support to key Objective-C Firebase pods, which is a crucial fix for compatibility with static framework builds, especially for React Native and Expo users. The changes are clear, well-motivated, and correctly implemented by setting DEFINES_MODULE = YES. The detailed explanation in the pull request description is very helpful. I have one minor stylistic suggestion to improve consistency across the podspec files.

Copy link
Member

@ncooke3 ncooke3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ncooke3 ncooke3 merged commit d924241 into firebase:main Nov 17, 2025
1 check passed
ncooke3 added a commit that referenced this pull request Nov 17, 2025
ncooke3 added a commit that referenced this pull request Nov 17, 2025
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

Successfully merging this pull request may close these issues.

iOS build fails: 'FirebaseAuth/FirebaseAuth-Swift.h' file not found in React Native + FirebaseAuth setup

3 participants