firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.58k stars 1.46k forks source link

Analytics cinterop not working #13138

Closed BasBuijsen closed 3 months ago

BasBuijsen commented 3 months ago

Description

When i use the firebase analytics sdk as a dependency in KMP via the cocoapods integration, it cant find symbols for the selected architecture. This issue is not present on all other firebase products so it seems to be an issue with analytics itself. I have been trying to find a solution but i can't seem to find it. Im hoping anyone here can help me out since i think it might be an issue in the sdk itself.

Reproducing the issue

Create a KMP project with cocoapods as integration method, add firebase as pod dependency in the cocoapods section.

Firebase SDK Version

10.27.0

Xcode Version

15.3

Installation Method

CocoaPods

Firebase Product(s)

Analytics

Targeted Platforms

All

Relevant Log Output

Undefined symbols for architecture arm64:
  "_FIRInstallationIDDidChangeNotification", referenced from:
      +[FIRAnalytics observeFirebaseInstallationIDChanges] in FirebaseAnalytics[arm64][10](FIRAnalytics.o)
  "_GULIsLoggableLevel", referenced from:
      -[APMMonitor isLoggableLevel:] in GoogleAppMeasurement[arm64][68](APMMonitor.o)
  "_GULLogBasic", referenced from:
      -[APMASLLogger logMessage:logTag:messageCode:withLogLevel:] in GoogleAppMeasurement[arm64][12](APMASLLogger.o)
  "_GULLogError", referenced from:
      -[APMPersistentDictionary initWithFileName:] in GoogleAppMeasurement[arm64][257](APMPersistentDictionary.o)
      _APMWriteDictionaryToURL in GoogleAppMeasurement[arm64][257](APMPersistentDictionary.o)
      -[APMUserDefaults synchronize] in GoogleAppMeasurement[arm64][311](APMUserDefaults.o)
  "_GULLogInfo", referenced from:
      ___44+[UIViewController(APMScreenClassName) load]_block_invoke in GoogleAppMeasurement[arm64][330](UIViewController+APMScreenClassName.o)
  "_GULLogWarning", referenced from:
      +[APMMeasurement sharedInstance] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      -[APMPersistentDictionary objectForKey:] in GoogleAppMeasurement[arm64][257](APMPersistentDictionary.o)
      -[APMPersistentDictionary setObject:forKey:] in GoogleAppMeasurement[arm64][257](APMPersistentDictionary.o)
      -[APMUserDefaults objectForKey:] in GoogleAppMeasurement[arm64][311](APMUserDefaults.o)
      -[APMUserDefaults setObject:forKey:] in GoogleAppMeasurement[arm64][311](APMUserDefaults.o)
      -[APMUserDefaults synchronize] in GoogleAppMeasurement[arm64][311](APMUserDefaults.o)
      ___44+[UIViewController(APMScreenClassName) load]_block_invoke in GoogleAppMeasurement[arm64][330](UIViewController+APMScreenClassName.o)
      ...
  "_GULSetLoggerLevel", referenced from:
      -[APMMonitor setDebugModeEnabled:] in GoogleAppMeasurement[arm64][68](APMMonitor.o)
      -[APMMonitor setDebugModeEnabled:] in GoogleAppMeasurement[arm64][68](APMMonitor.o)
      -[APMMonitor setVerboseLoggingEnabled:] in GoogleAppMeasurement[arm64][68](APMMonitor.o)
  "_OBJC_CLASS_$_FIRInstallations", referenced from:
       in FirebaseAnalytics[arm64][10](FIRAnalytics.o)
  "_OBJC_CLASS_$_GULAppDelegateSwizzler", referenced from:
       in GoogleAppMeasurement[arm64][7](APMAnalytics.o)
  "_OBJC_CLASS_$_GULAppEnvironmentUtil", referenced from:
       in GoogleAppMeasurement[arm64][5](APMAEU.o)
  "_OBJC_CLASS_$_GULMutableDictionary", referenced from:
       in GoogleAppMeasurement[arm64][35](APMEExperiment.o)
  "_OBJC_CLASS_$_GULNetwork", referenced from:
       in GoogleAppMeasurement[arm64][7](APMAnalytics.o)
  "_OBJC_CLASS_$_GULSwizzler", referenced from:
       in GoogleAppMeasurement[arm64][330](UIViewController+APMScreenClassName.o)
  "_kGULNetworkHTTPStatusCodeCannotAcceptTraffic", referenced from:
      -[APMETaskManager handleFetchingExperimentsResponse:data:error:] in GoogleAppMeasurement[arm64][42](APMETaskManager.o)
      -[APMMeasurement networkUploadCompletionHandlerWithResponse:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      -[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
  "_kGULNetworkHTTPStatusCodeNotFound", referenced from:
      -[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
  "_kGULNetworkHTTPStatusCodeNotModified", referenced from:
      ___37-[APMMeasurement retrievePSMResponse]_block_invoke in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      -[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      -[APMMeasurement(SKAN) handleSKANFetchResponse:data:error:] in GoogleAppMeasurement[arm64][66](APMMeasurement+SKAN.o)
      ___46-[APMMeasurement(URL) requestDeferredDeepLink]_block_invoke in GoogleAppMeasurement[arm64][67](APMMeasurement+URL.o)
  "_kGULNetworkHTTPStatusCodeUnavailable", referenced from:
      -[APMETaskManager handleFetchingExperimentsResponse:data:error:] in GoogleAppMeasurement[arm64][42](APMETaskManager.o)
      -[APMMeasurement networkUploadCompletionHandlerWithResponse:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      -[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
  "_kGULNetworkHTTPStatusNoContent", referenced from:
      -[APMETaskManager handleFetchingExperimentsResponse:data:error:] in GoogleAppMeasurement[arm64][42](APMETaskManager.o)
      -[APMMeasurement networkUploadCompletionHandlerWithResponse:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      ___37-[APMMeasurement retrievePSMResponse]_block_invoke in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      -[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      ___46-[APMMeasurement(URL) requestDeferredDeepLink]_block_invoke in GoogleAppMeasurement[arm64][67](APMMeasurement+URL.o)
  "_kGULNetworkHTTPStatusOK", referenced from:
      -[APMETaskManager handleFetchingExperimentsResponse:data:error:] in GoogleAppMeasurement[arm64][42](APMETaskManager.o)
      -[APMMeasurement networkUploadCompletionHandlerWithResponse:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      ___37-[APMMeasurement retrievePSMResponse]_block_invoke in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      -[APMMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in GoogleAppMeasurement[arm64][62](APMMeasurement.o)
      -[APMMeasurement(SKAN) handleSKANFetchResponse:data:error:] in GoogleAppMeasurement[arm64][66](APMMeasurement+SKAN.o)
      ___46-[APMMeasurement(URL) requestDeferredDeepLink]_block_invoke in GoogleAppMeasurement[arm64][67](APMMeasurement+URL.o)
  "_pb_decode", referenced from:
      _apmpb_decode_app_property in GoogleAppMeasurement[arm64][78](apmpb_app_property_decoder.o)
      _apmpb_decode_audience in GoogleAppMeasurement[arm64][81](apmpb_audience_decoder.o)
      _apmpb_decode_audience in GoogleAppMeasurement[arm64][81](apmpb_audience_decoder.o)
      _apmpb_decode_audience_leaf_filter_result in GoogleAppMeasurement[arm64][84](apmpb_audience_leaf_filter_result_decoder.o)
      _apmpb_decode_audience_leaf_filter_result in GoogleAppMeasurement[arm64][84](apmpb_audience_leaf_filter_result_decoder.o)
      _apmpb_decode_client_property in GoogleAppMeasurement[arm64][87](apmpb_client_property_decoder.o)
      _apmpb_decode_client_property in GoogleAppMeasurement[arm64][87](apmpb_client_property_decoder.o)
      ...
  "_pb_decode_varint", referenced from:
      _nano_decode_repeated_uint64 in GoogleAppMeasurement[arm64][315](decoder_common.o)
  "_pb_encode", referenced from:
      _nano_two_pass_encoding in GoogleAppMeasurement[arm64][316](encoder_common.o)
      _nano_two_pass_encoding in GoogleAppMeasurement[arm64][316](encoder_common.o)
  "_pb_encode_string", referenced from:
      _nano_encode_string in GoogleAppMeasurement[arm64][316](encoder_common.o)
  "_pb_encode_submessage", referenced from:
      _apmpb_encode_repeated_audience in GoogleAppMeasurement[arm64][82](apmpb_audience_encoder.o)
      _apmpb_encode_repeated_audience_leaf_filter_result in GoogleAppMeasurement[arm64][85](apmpb_audience_leaf_filter_result_encoder.o)
      _apmpb_encode_repeated_client_property in GoogleAppMeasurement[arm64][88](apmpb_client_property_encoder.o)
      _apmpb_encode_repeated_consent_default_entry in GoogleAppMeasurement[arm64][94](apmpb_consent_default_entry_encoder.o)
      _apmpb_encode_repeated_consent_delegation_entry in GoogleAppMeasurement[arm64][97](apmpb_consent_delegation_entry_encoder.o)
      _apmpb_encode_repeated_core_platform_service_entry in GoogleAppMeasurement[arm64][100](apmpb_core_platform_service_entry_encoder.o)
      _apmpb_encode_repeated_custom_property in GoogleAppMeasurement[arm64][103](apmpb_custom_property_encoder.o)
      ...
  "_pb_encode_tag_for_field", referenced from:
      _apmpb_encode_repeated_audience in GoogleAppMeasurement[arm64][82](apmpb_audience_encoder.o)
      _apmpb_encode_repeated_audience_leaf_filter_result in GoogleAppMeasurement[arm64][85](apmpb_audience_leaf_filter_result_encoder.o)
      _apmpb_encode_repeated_client_property in GoogleAppMeasurement[arm64][88](apmpb_client_property_encoder.o)
      _apmpb_encode_repeated_consent_default_entry in GoogleAppMeasurement[arm64][94](apmpb_consent_default_entry_encoder.o)
      _apmpb_encode_repeated_consent_delegation_entry in GoogleAppMeasurement[arm64][97](apmpb_consent_delegation_entry_encoder.o)
      _apmpb_encode_repeated_core_platform_service_entry in GoogleAppMeasurement[arm64][100](apmpb_core_platform_service_entry_encoder.o)
      _apmpb_encode_repeated_custom_property in GoogleAppMeasurement[arm64][103](apmpb_custom_property_encoder.o)
      ...
  "_pb_encode_varint", referenced from:
      _nano_encode_repeated_uint64 in GoogleAppMeasurement[arm64][316](encoder_common.o)
  "_pb_istream_from_buffer", referenced from:
      _apmpb_decode_app_property in GoogleAppMeasurement[arm64][78](apmpb_app_property_decoder.o)
      _apmpb_decode_audience in GoogleAppMeasurement[arm64][81](apmpb_audience_decoder.o)
      _apmpb_decode_audience in GoogleAppMeasurement[arm64][81](apmpb_audience_decoder.o)
      _apmpb_decode_audience_leaf_filter_result in GoogleAppMeasurement[arm64][84](apmpb_audience_leaf_filter_result_decoder.o)
      _apmpb_decode_audience_leaf_filter_result in GoogleAppMeasurement[arm64][84](apmpb_audience_leaf_filter_result_decoder.o)
      _apmpb_decode_client_property in GoogleAppMeasurement[arm64][87](apmpb_client_property_decoder.o)
      _apmpb_decode_client_property in GoogleAppMeasurement[arm64][87](apmpb_client_property_decoder.o)
      ...
  "_pb_ostream_from_buffer", referenced from:
      _nano_two_pass_encoding in GoogleAppMeasurement[arm64][316](encoder_common.o)
  "_pb_read", referenced from:
      _apmpb_decode_repeated_audience in GoogleAppMeasurement[arm64][81](apmpb_audience_decoder.o)
      _apmpb_decode_repeated_audience in GoogleAppMeasurement[arm64][81](apmpb_audience_decoder.o)
      _apmpb_decode_repeated_audience_leaf_filter_result in GoogleAppMeasurement[arm64][84](apmpb_audience_leaf_filter_result_decoder.o)
      _apmpb_decode_repeated_audience_leaf_filter_result in GoogleAppMeasurement[arm64][84](apmpb_audience_leaf_filter_result_decoder.o)
      _apmpb_decode_repeated_client_property in GoogleAppMeasurement[arm64][87](apmpb_client_property_decoder.o)
      _apmpb_decode_repeated_client_property in GoogleAppMeasurement[arm64][87](apmpb_client_property_decoder.o)
      _apmpb_decode_repeated_consent_default_entry in GoogleAppMeasurement[arm64][93](apmpb_consent_default_entry_decoder.o)
      _apmpb_decode_repeated_consent_default_entry in GoogleAppMeasurement[arm64][93](apmpb_consent_default_entry_decoder.o)
      ...

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
```json Replace this line with the contents of your Package.resolved. ```

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
```kotlin cocoapods { ios.deploymentTarget = "16.0" framework { baseName = "..." } noPodspec() pod("FirebaseAnalytics") { version = "10.27.0" extraOpts += listOf("-compiler-option", "-fmodules") } } ```
google-oss-bot commented 3 months ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

paulb777 commented 3 months ago

It may be related to FirebaseAnalytics being a binary distribution instead of a source distribution like the other Firebase products.

Swift Package Manager has a similar issue, for which the workaround is to create a placeholder source wrapper target to specify the Analytics dependencies.

paulb777 commented 3 months ago

I'm going to close since we don't support KMP. The KMP community or stackoverflow may be a better place for support. We can still continue the conversation here though.