Skip to content

Commit 4560889

Browse files
Add modular headers support to Objective-C Firebase pods for static framework 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 #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.
1 parent 436de0b commit 4560889

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

FirebaseCore.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
5656
s.dependency 'FirebaseCoreInternal', '~> 12.7.0'
5757

5858
s.pod_target_xcconfig = {
59+
'DEFINES_MODULE' => 'YES',
5960
'GCC_PREPROCESSOR_DEFINITIONS' => 'Firebase_VERSION=' + s.version.to_s,
6061
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"',
6162
'OTHER_CFLAGS' => '-fno-autolink'

FirebaseCoreExtension.podspec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@ Pod::Spec.new do |s|
3434
"#{s.module_name}_Privacy" => 'FirebaseCore/Extension/Resources/PrivacyInfo.xcprivacy'
3535
}
3636

37+
s.pod_target_xcconfig = {
38+
'DEFINES_MODULE' => 'YES'
39+
}
40+
3741
s.dependency 'FirebaseCore', '~> 12.7.0'
3842
end

FirebaseInstallations.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Pod::Spec.new do |s|
5252

5353
preprocessor_definitions = ''
5454
s.pod_target_xcconfig = {
55+
'DEFINES_MODULE' => 'YES',
5556
'GCC_PREPROCESSOR_DEFINITIONS' => preprocessor_definitions,
5657
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
5758
}

0 commit comments

Comments
 (0)