Scrungepipes
Scrungepipes

Reputation: 37581

How to add FirebaseFirestoreSwift to workspace || Is FirebaseFirestoreSwift incompatible with React Native?

I want to use Firestore in my app but if I add 'FirebaseFirestoreSwift' to my podfile then I get a pod install/update error:

[!] The following Swift pods cannot yet be integrated as static libraries:The Swift pod FirebaseFirestoreSwift depends upon FirebaseFirestore, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.

So I tried this:

pod 'Firebase/Firestore'
pod 'FirebaseFirestoreSwift', :modular_headers => true

But just got the same error, so tried this:

pod 'Firebase/Firestore', :modular_headers => true
pod 'FirebaseFirestoreSwift'

But still got the same error, so tried this:

  use_modular_headers!
  pod 'Firebase/Firestore'
  pod 'FirebaseFirestoreSwift'

Now there's no error when installing the pods, but there's now a new linking error when building that wasn't there previously:

Module map file '/Users/..../ios/Pods/Headers/Private/openssl_grpc/BoringSSL-GRPC.modulemap' not found

The app is a React Native app and the openssl_grpc must be being added as part of that.

So my question, how can I add FirebaseFirestoreSwift to the app if doing so messes up React Native?

Upvotes: 0

Views: 4455

Answers (3)

Paul Beusterien
Paul Beusterien

Reputation: 29572

Try use_frameworks! or use_frameworks! :linkage => :static.

More background at https://blog.cocoapods.org/CocoaPods-1.9.0-beta/

May 2024 UPDATE: It's no longer necessary to install import FirebaseFirestoreSwift. It's functionality is now included in FirebaseFirestore.

Upvotes: 2

Esben von Buchwald
Esben von Buchwald

Reputation: 3112

What worked for me as of october 2022 with Xcode 14.0.1, RNFirebase 16.2.0 and RN 0.66.4:

target 'MyApp' do
  # ...

  # Add these two lines
  pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true

  # ...
end

Upvotes: 0

Apix_D
Apix_D

Reputation: 1101

i had the same issue and added use_frameworks! , like Paul already posted... This works for me.

My podfile looks like this now.

target 'HiProject' do
use_frameworks!

pod 'Firebase' 
pod 'Alamofire'
pod 'SwiftyJSON'
pod 'EAIntroView'
pod 'lottie-ios'
pod 'Firebase/Firestore'
pod 'Firebase/Auth'
pod 'FirebaseFirestoreSwift'

end

Upvotes: 0

Related Questions