I am using firebase as part of a project I am working on in iOS, and I just stumbled upon the following linking error when I try to compile my code against an iPhone 6 or 7
Also had this problem after installing pods for Firebase, using CocoaPods as explained in the Firebase site:
https://firebase.google.com/docs/ios/setup?hl=es-419#prerequisites
pod 'Firebase/Analytics' pod 'Firebase/Auth'
During the installation of the pods I received a warning telling that:
[!] The target `myTarget [Debug]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target `myTarget [Release]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
When I compiled I got the error for several files:
Undefined symbols for architecture x86_64:
I tried the solution of the following answer before the one in this answer, and it worked as a charm:
The target ... overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig
Basically the solution was (as explained by @Ankish Jain):
Go to your Target Build Settings -> Other linker flags -> double click -> + button. Add $(inherited) to a new line.
After that I compiled succesfully, and new flag where added automatically to the Build Settings.
In my case everything worked after removing $(inherited)
from Other Linker Flags
Check your Other linker flags: sometimes adding or removing $(inherited)
solves the issue.
I tried the "clearing Cocoapods cache" and the "removing derived data" solutions but that didn't work. What worked for me was a step I found in the Carthage setup (I'm still using Cocoapods)
Add
$(OTHER_LDFLAGS) -ObjC
flag to "Other Linker Flags" in "Build Settings".
You can see the step here: https://github.com/firebase/firebase-ios-sdk/blob/master/Carthage.md
My Info
Installation: Cocoapods | SDK: FirebaseAnalytics (6.1.2) | IDE: Xcode 11.0 | macOS: Mojave 10.14.5 Beta | Language: Swift 4.2 | Platform Target: iOS 11.0+
It seems to be a glitch with derived data. I quitted out of Xcode, I removed all Derived Data in /Users/USER_NAME/Library/Developer/Xcode/PROJECT_NAME
Restarted Xcode, compiled and all works as expected, no need to change anything in Active Architecture Only
or anything.