My setup with Firebase is based on Carthage and everything is working great with that. But now that we have migrated to MLKit (they do not have support for Carthage) we have included 2 of the libraries from MLKit that we need through Cocoapods, but we keep on getting this linker errors.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GULSwizzler", referenced from:
objc-class-ref in GoogleAppMeasurement(UIViewController+APMScreenClassName_af3349bd4002ca3c2f62fd10b41b3eb5.o)
objc-class-ref in FirebasePerformance(FPRSelectorInstrumentor.o)
objc-class-ref in FirebasePerformance(FPRProxyObjectHelper.o)
"_OBJC_CLASS_$_GULSceneDelegateSwizzler", referenced from:
objc-class-ref in FirebaseAuth(FIRAuth.o)
"_kGULNetworkHTTPStatusCodeNotModified", referenced from:
-[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
___46-[APMMeasurement(URL) requestDeferredDeepLink]_block_invoke in GoogleAppMeasurement(APMMeasurement+URL_89002570063d654e31cbed7a49d52cf9.o)
"_kGULNetworkHTTPStatusCodeNotFound", referenced from:
-[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
"_kGULNetworkHTTPStatusCodeCannotAcceptTraffic", referenced from:
-[APMMeasurement networkUploadCompletionHandlerWithResponse:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
-[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
-[APMETaskManager handleFetchingExperimentsResponse:data:error:] in GoogleAppMeasurement(APMETaskManager_93d6b77f5177bbfd267beceb0e63504e.o)
"_kGULNetworkHTTPStatusNoContent", referenced from:
-[APMMeasurement networkUploadCompletionHandlerWithResponse:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
-[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
-[APMETaskManager handleFetchingExperimentsResponse:data:error:] in GoogleAppMeasurement(APMETaskManager_93d6b77f5177bbfd267beceb0e63504e.o)
___46-[APMMeasurement(URL) requestDeferredDeepLink]_block_invoke in GoogleAppMeasurement(APMMeasurement+URL_89002570063d654e31cbed7a49d52cf9.o)
"_kGULNetworkHTTPStatusCodeUnavailable", referenced from:
-[APMMeasurement networkUploadCompletionHandlerWithResponse:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
-[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
-[APMETaskManager handleFetchingExperimentsResponse:data:error:] in GoogleAppMeasurement(APMETaskManager_93d6b77f5177bbfd267beceb0e63504e.o)
"_OBJC_CLASS_$_GULNetwork", referenced from:
objc-class-ref in GoogleAppMeasurement(APMAnalytics_8aebbab89e8f679989831a91d692718a.o)
objc-class-ref in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
objc-class-ref in GoogleAppMeasurement(APMAppDelegateInterceptor_8e30f6012706bd788ce60da1e2c6b7b7.o)
objc-class-ref in GoogleAppMeasurement(APMETaskManager_93d6b77f5177bbfd267beceb0e63504e.o)
"_OBJC_CLASS_$_GULAppDelegateSwizzler", referenced from:
objc-class-ref in GoogleAppMeasurement(APMAnalytics_8aebbab89e8f679989831a91d692718a.o)
objc-class-ref in FirebaseAuth(FIRAuth.o)
"_kGULNetworkHTTPStatusOK", referenced from:
-[APMMeasurement networkUploadCompletionHandlerWithResponse:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
-[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
-[APMETaskManager handleFetchingExperimentsResponse:data:error:] in GoogleAppMeasurement(APMETaskManager_93d6b77f5177bbfd267beceb0e63504e.o)
___46-[APMMeasurement(URL) requestDeferredDeepLink]_block_invoke in GoogleAppMeasurement(APMMeasurement+URL_89002570063d654e31cbed7a49d52cf9.o)
"_OBJC_CLASS_$_GULObjectSwizzler", referenced from:
objc-class-ref in FirebasePerformance(FPRNetworkTrace.o)
objc-class-ref in FirebasePerformance(FPRNSURLConnectionInstrument.o)
objc-class-ref in FirebasePerformance(FPRObjectInstrumentor.o)
"_OBJC_CLASS_$_GULMutableDictionary", referenced from:
objc-class-ref in GoogleAppMeasurement(APMEExperiment_b4b8ea2ce659b487b048910f72991ad3.o)
objc-class-ref in GoogleAppMeasurement(APMEExperimentRequestBuilder_43951e9ffb98994ef55aaa739e6b31f6.o)
objc-class-ref in GoogleAppMeasurement(APMEManager_571d5ebf632e7ae66d886cd64faba90f.o)
objc-class-ref in GoogleAppMeasurement(APMRemoteConfig_5115867d904d12fe7a11986cd4c600a1.o)
objc-class-ref in GoogleAppMeasurement(APMESnapshot_013c5a04b20274dfe2124ec50deb4011.o)
ld: symbol(s) not found for architecture x86_64
Setting everything up with Cocoapods does not throw this linker issues. But we want to really try to keep the Carthage setup for Firebase.
My Podfile includes these two pods:
pod 'GoogleMLKit/BarcodeScanning'
pod 'GoogleMLKit/ObjectDetection'
and my Cartfile looks as follows:
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" == 6.33.0
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseCrashlyticsBinary.json" == 6.33.0
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseRemoteConfigBinary.json" == 6.33.0
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebasePerformanceBinary.json" == 6.33.0
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json" == 6.33.0
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseProtobufBinary.json" == 6.33.0
It's not supported to mix Carthage and CocoaPods. Both MLKit and Firebase have conflicting sets of dependencies on the GoogleUtilities framework that don't get correctly resolved.
It may be possible to workaround by removing the GoogleUtilities.framework from the Carthage installation and then explicitly adding the necessary set of its subspecs in the Podfile.