Hi. I am using Ionic 4 to develop an app, and am having some problems when I try to build it for iOS. When I attempt to run the app in Xcode, it will fail in the linking phase with the following error:
ld: 346 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation).
This is preceded by a list of the duplicate symbols like so:
duplicate symbol OBJC_IVAR$_FIRInstanceIDURLQueryItem._name in: /Users/james/Library/Developer/Xcode/DerivedData/Jambox-ataoinheliizvyaczvbklhkqvhpf/Build/Products/Debug-iphonesimulator/FirebaseInstanceID/libFirebaseInstanceID.a(FIRInstanceIDURLQueryItem.o) Jambox/Plugins/cordova-plugin-firebase/FirebaseInstanceID.framework/FirebaseInstanceID(FIRInstanceIDURLQueryItem_ce817fff617a4255d51c2a25da32a1f0.o)
These are relating to the following frameworks:
- FirebaseInstanceID.framework
- GoogleUtilities.framework
- nanopb.framework
- FirebaseCore.framework
I have tried a few solutions to this problem, but none result in success:
1). Removing -ObjC and $(inherited) from Other Linker Flags - this causes the app to build and link successfully, but crash on startup with this error:
*** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘+[FIRApp registerAsConfigurable:]: unrecognized selector sent to class 0x1080bc178’
2). Removing each framework in the list of duplicate symbols - this helps in lowering the number of duplicate symbols. I can get it down to 65 duplicate symbols until I have to remove GoogleUtilities.framework, which causes the build the fail with this error:
Undefined symbols for architecture x86_64:
“OBJC_CLASS$_GULObjectSwizzler”, referenced from: objc-class-ref in FirebasePerformance(FPRObjectInstrumentor_f65d32035cadef24185912716f0b12f9.o) objc-class-ref in FirebasePerformance(FPRNetworkTrace_3053ec2ab59f2fcfec4b18c29e4b4cec.o) objc-class-ref in FirebasePerformance(FPRNSURLConnectionInstrument_5611d225f62417fa73742554b6a45401.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
3). Deleting DerivedData folder - I get the same errors after doing this.
4). Removing and adding the iOS platform - Same errors.