0

My application has four targets and I want to use Firebase in 3 of them. How can I do it ?

What I tried:

I create the podfile like this :

platform: iOS, '12.3'
use_frameworks!

def firebasePods
  pod 'Firebase/Auth'
end

target 'Application' do

  # Pods for Tinder1104

  firebasePods

end


target 'FeatureX' do

  # Pods for TinderiOSApp

  firebasePods

end

target 'FeatureY' do

  # Pods for TinderiOSApp

  firebasePods

end

target 'FeatureZ' do

  # Pods for TinderiOSApp


end

I put the GoogleService-Info.plist file in the Application target. The app runs but I got warnings on the console, it's similar to this post: Class X is implemented in both <framework> and <application> one of the two will be used, which one is undefined

And My app cannot connect to Firebase server even I added initialization code FirebaseApp.configure(). Then when I try to use Auth, my app crashes because of reason:

The default FIRApp instance must be configured before the default FIRAuthinstance can be initialized. 
One way to ensure that is to call `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) in the App Delegate's `application:didFinishLaunchingWithOptions:` 
(`application(_:didFinishLaunchingWithOptions:)` in Swift).
Tung Vu Duc
  • 1,552
  • 1
  • 13
  • 22

1 Answers1

0

The Firebase pods are statically linked and therefore can only be linked once into your app. You either need to also statically link each Feature target or refactor so that Firebase is only linked once.

Paul Beusterien
  • 27,542
  • 6
  • 83
  • 139