Vyacheslav Vyacheslav - 4 years ago 116
Swift Question

Google Ads using FireBase + CocoaPods gives error: "duplicated symbols for architechture x86_64"

target 'myapp' do
pod 'Firebase/Core'
#the other projects not related with Firebase
use_frameworks!
end


leads to this error:


51968 duplicated symbols for architechture x86_64


the callstack consists of compiled classes from the other frameworks.

Swift 3 , XCode 8.

Without this pod (FireBase) my project works correctly.

Answer Source

The problem was about -ObjC flag. CocoaPods added this flag into Other linker flags project automatically.

But this this flag my other custom projects did not build properly. In order to fix this I did these steps.

  1. https://firebase.google.com/docs/ios/setup I've dowloaded file under Integrate without CocoaPods .
  2. Dragged several franeworks into file as described at Readme.md : FirebaseAnalytics.framework, FirebaseCore.framework, FirebaseInstanceID.framework, GoogleInterchangeUtilities.framework, GoogleSymbolUtilities.framework, GoogleToolboxForMac.framework and for admob: GoogleMobileAds.framework
  3. In order to prevent -ObjC flat that force use all libraries I've changed Other linker flag using -force_load . That is, -force_load GoogleMobileAds.framework/GoogleMobileAds -force_load FirebaseAnalytics.framework/FirebaseAnalytics -force_load FirebaseCore.framework/FirebaseCore -force_load GoogleToolboxForMac.framework/GoogleToolboxForMac -force_load GoogleSymbolUtilities.framework/GoogleSymbolUtilities -force_load GoogleInterchangeUtilities.framework/GoogleInterchangeUtilities -force_load FirebaseInstanceID.framework/FirebaseInstanceID

Do not forget to create and download GoogleService-Info.plist file inside console: https://console.firebase.google.com

** EDIT **

Version 3.12 rejects -force_load GoogleSymbolUtilities.framework/GoogleSymbolUtilities

So , now correct solution is:

-force_load GoogleMobileAds.framework/GoogleMobileAds -force_load FirebaseAnalytics.framework/FirebaseAnalytics -force_load FirebaseCore.framework/FirebaseCore -force_load GoogleToolboxForMac.framework/GoogleToolboxForMac -force_load GoogleInterchangeUtilities.framework/GoogleInterchangeUtilities -force_load FirebaseInstanceID.framework/FirebaseInstanceID

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download