When Unity exports an Xcode project, the BUILD_LIBRARY_FOR_DISTRIBUTION build setting was explicitly set to NO for each CocoaPods target.
Starting with Unity 6000.3.0f1+, this build setting is no longer present in the generated Xcode project’s pod build settings. As a result, the build fails, specifically for the AppMetricaLibraryAdapter target:
Undefined symbols for architecture arm64:
"AppMetricaLibraryAdapter.AppMetricaLibraryAdapter.shared.unsafeMutableAddressor: AppMetricaLibraryAdapter.AppMetricaLibraryAdapter"
referenced from: MACAnalytics.MACAnonymousMetricaReporter.__allocating_init () ->
MACAnalytics.MACAnonymousMetricaReporter in YandexMobileAds [992] (MACAnonymousMetricaReporter.o)
MACAnalytics.MACAdsMetricaAnalyticsTracker._allocating_init(apiKey: Swift.String) ->
MACAnalytics.MACAdsMetricaAnalyticsTracker? in YandexMobileAds [993] (MACAdsMetricaAnalyticsTracker.o)
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Setting BUILD_LIBRARY_FOR_DISTRIBUTION = NO is required for the correct operation of Yandex Ads and its dependency on AppMetrica. Without this setting, the AppMetrica-related pods cannot be built successfully.
Workaround
Add the following post_install hook to your Podfile to explicitly enforce the required build setting for the affected targets:
post_install do |installer|
problematic_targets = ['AppMetricaLibraryAdapter']
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if problematic_targets.include?(target.name)
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'NO'
end
end
end
end
After updating the Podfile, run the following command in the terminal to apply the changes:
This will regenerate the Pods project with the correct build settings applied.
When Unity exports an Xcode project, the
BUILD_LIBRARY_FOR_DISTRIBUTIONbuild setting was explicitly set toNOfor each CocoaPods target.Starting with Unity 6000.3.0f1+, this build setting is no longer present in the generated Xcode project’s pod build settings. As a result, the build fails, specifically for the
AppMetricaLibraryAdaptertarget:Setting
BUILD_LIBRARY_FOR_DISTRIBUTION = NOis required for the correct operation of Yandex Ads and its dependency on AppMetrica. Without this setting, the AppMetrica-related pods cannot be built successfully.Workaround
Add the following
post_installhook to yourPodfileto explicitly enforce the required build setting for the affected targets:After updating the
Podfile, run the following command in the terminal to apply the changes:This will regenerate the Pods project with the correct build settings applied.