3

I use Swift Frameworks (Cocoa Touch Framework) to segment code into fairly independent modules.I have imported several external libraries, with Cocoapods, into the main app and those modules without any issues so far.

Xcode 9.3

iOS 11.2

CocoaPods 1.5

GoogleToolboxForMac (2.1.3), Firebase (4.13.0), FirebaseAnalytics (4.2.0), FirebaseCore (4.0.20), FirebaseDatabase (4.1.5), FirebaseInstanceID (2.0.10)

However when I import Firebase in any of those modules, in addition to importing it in the main app, my application crashes.

I don't even need to use anything from Firebase in the modules ; simply adding the pod to the target (module Store in this case) in the Podfile will crash the app as soon as I leave the main window (fira_viewDidDisappear).

There is also a long list of issues during startup (that were also reported by others), all similar to :

objc[36264]: Class FIRAIdentifiers is implemented in both /{$userdir}/Library/Developer/Xcode/DerivedData/FrameWork101-aekmajbumgzabmayoanlcrwtzbcs/Build/Products/Debug-iphonesimulator/Store.framework/Store (0x105478318) and /{$userdir}/Library/Developer/CoreSimulator/Devices/31D920E9-CD46-47C4-9631-503B3471AAF7/data/Containers/Bundle/Application/57B8020D-E2AB-4A06-B654-5F26F8E00AF6/FrameWork101.app/FrameWork101 (0x103b1ef80). One of the two will be used. Which one is undefined.

Pretty ominous statement...

There are several threads somewhat related to this :

And even an issue (#6619) filed...

But they don't have a clear resolution / answer and the issue has even been closed without any resolution.

So is there a way to use Firebase in a modular approach (using frameworks) ? If so what's the best way to make this works ? Or is the Firebase SDK too invasive to do so ?

Thanks !

Podfile :

project 'FrameWork101.xcodeproj'

platform :ios, '11.2'

target 'Binding' do
  use_frameworks!    
  pod 'ReactiveKit'
  pod 'Bond'
end

target 'Model' do
  use_frameworks!
  target 'ModelTests' do
    inherit! :search_paths
  end    
end

target 'Service' do
  use_frameworks!
  pod 'ReactiveKit'
  pod 'Bond'
end

target 'View' do
  use_frameworks!
  pod 'ReactiveKit'
  pod 'Bond'
end

target 'Store' do
  use_frameworks!
  pod 'ReactiveKit'
  pod 'Bond'
  pod 'Firebase/Database'   <---- comment this out and it works fine.
end

target 'FrameWork101' do
  use_frameworks!
  pod 'Firebase/Core'
  pod 'ReactiveKit'
  pod 'Bond'
  target 'FrameWork101Tests' do
    inherit! :search_paths
  end
end

And part of the crash report :

FIRAScreenClassName crash

Community
  • 1
  • 1
Nick
  • 321
  • 3
  • 16
  • Did you find a solution @Nick? I'm having the same issue. – Franco Jul 20 '18 at 03:33
  • @Franco : unfortunately I did not. Every time you declare it in different frameworks which end up being part of the same application, it crashes. So I went for a different route : I used the [Firebase REST APIs](https://firebase.google.com/docs/reference/rest/database/). They have a fair amount of limitations but I was able to make it work for my needs. HTH. – Nick Jul 21 '18 at 15:23

0 Answers0