Mediation Initialization Failed On Ios

Hello, I have some problems with mediation on ios. When running build on iphone, xcode output shows this "
Initialization Failed: Unknown:Failed to sort tree! It is likely there is a missing required dependency:"

How to handle this problem? There is no any info about this.

Full log:

Initializing...
<Start>d__3:MoveNext()
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(TStateMachine&)
M_Rewarded:Start()

Initialization Failed: Unknown:Failed to sort tree! It is likely there is a missing required dependency:
{
  "ordered": [
    {
      "packageHash": 265526080,
      "packageProvider": "CorePackageInitializer",
      "packageDependencies": []
    },
    {
      "packageHash": 220961824,
      "packageProvider": "MediationServiceInitializer",
      "packageDependencies": [
        {
          "dependencyHash": 265726432,
          "dependencyComponent": "IInstallationId",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        },
        {
          "dependencyHash": 199317712,
          "dependencyComponent": "IProjectConfiguration",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        }
      ]
    }
  ],
  "packages": [
    {
      "packageHash": 220961824,
      "packageProvider": "MediationServiceInitializer",
      "packageDependencies": [
        {
          "dependencyHash": 265726432,
          "dependencyComponent": "IInstallationId",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        },
        {
          "dependencyHash": 199317712,
          "dependencyComponent": "IProjectConfiguration",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        }
      ]
    },
    {
      "packageHash": 220887792,
      "packageProvider": "Ua2CoreInitializeCallback",
      "packageDependencies": [
        {
          "dependencyHash": 265726432,
          "dependencyComponent": "IInstallationId",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        },
        {
          "dependencyHash": 221218192,
          "dependencyComponent": "IEnvironments",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        },
        {
          "dependencyHash": 199317712,
          "dependencyComponent": "IProjectConfiguration",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        },
        {
          "dependencyHash": 266190160,
          "dependencyComponent": "IPlayerId",
          "dependencyProvided": "false",
          "dependencyOptional": "false"
        }
      ]
    },
    {
      "packageHash": 265526080,
      "packageProvider": "CorePackageInitializer",
      "packageDependencies": []
    },
    {
      "packageHash": 265320352,
      "packageProvider": "CorePackageInitializer",
      "packageDependencies": [
        {
          "dependencyHash": 199317712,
          "dependencyComponent": "IProjectConfiguration",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        },
        {
          "dependencyHash": 265726432,
          "dependencyComponent": "IInstallationId",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        },
        {
          "dependencyHash": 200053392,
          "dependencyComponent": "IAccessToken",
          "dependencyProvided": "false",
          "dependencyOptional": "false"
        },
        {
          "dependencyHash": 266190160,
          "dependencyComponent": "IPlayerId",
          "dependencyProvided": "false",
          "dependencyOptional": "false"
        }
      ]
    },
    {
      "packageHash": 265602176,
      "packageProvider": "IapCoreInitializeCallback",
      "packageDependencies": [
        {
          "dependencyHash": 220869920,
          "dependencyComponent": "IMetricsFactory",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        },
        {
          "dependencyHash": 220905056,
          "dependencyComponent": "IDiagnosticsFactory",
          "dependencyProvided": "true",
          "dependencyOptional": "false"
        }
      ]
    }
  ],
  "components": [
    {
      "componentHash": 265726432,
      "component": "IInstallationId",
      "componentPackageHash": 265526080,
      "componentPackage": "CorePackageInitializer"
    },
    {
      "componentHash": 199317712,
      "component": "IProjectConfiguration",
      "componentPackageHash": 265526080,
      "componentPackage": "CorePackageInitializer"
    },
    {
      "componentHash": 221218192,
      "component": "IEnvironments",
      "componentPackageHash": 265526080,
      "componentPackage": "CorePackageInitializer"
    },
    {
      "componentHash": 266190160,
      "component": "IPlayerId",
      "componentPackageHash": 0,
      "componentPackage": "null"
    },
    {
      "componentHash": 200053392,
      "component": "IAccessToken",
      "componentPackageHash": 0,
      "componentPackage": "null"
    },
    {
      "componentHash": 220869920,
      "component": "IMetricsFactory",
      "componentPackageHash": 265526080,
      "componentPackage": "CorePackageInitializer"
    },
    {
      "componentHash": 220905056,
      "component": "IDiagnosticsFactory",
      "componentPackageHash": 265526080,
      "componentPackage": "CorePackageInitializer"
    }
  ]
}
Error: Component with hash[266190160] threw exception when sorting package[220887792][Ua2CoreInitializeCallback]
M_Rewarded:InitializationFailed(Exception)
<Start>d__3:MoveNext()
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(TStateMachine&)
M_Rewarded:Start()

Here is my podfile:

source 'https://cdn.cocoapods.org/'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'Protobuf'
  pod 'UnityMediationAdmobAdapter', :source => 'https://github.com/Unity-Technologies/unity-mediation-cocoapods-prod.git'
  pod 'UnityMediationAppLovinAdapter', :source => 'https://github.com/Unity-Technologies/unity-mediation-cocoapods-prod.git'
  pod 'UnityMediationSdk', '~> 0.5.0', :source => 'https://github.com/Unity-Technologies/unity-mediation-cocoapods-prod.git'
  pod 'UnityMediationUnityAdapter', :source => 'https://github.com/Unity-Technologies/unity-mediation-cocoapods-prod.git'
end
target 'Unity-iPhone' do
end



use_frameworks!

post_install do |installer|
  applicationTargets = [
    'Pods-Unity-iPhone',
  ]
  libraryTargets = [
    'Pods-UnityFramework',
  ]

  embedded_targets = installer.aggregate_targets.select { |aggregate_target|
    libraryTargets.include? aggregate_target.name
  }
  embedded_pod_targets = embedded_targets.flat_map { |embedded_target| embedded_target.pod_targets }
  host_targets = installer.aggregate_targets.select { |aggregate_target|
    applicationTargets.include? aggregate_target.name
  }

  host_targets.each do |host_target|
    host_target.xcconfigs.each do |config_name, config_file|
      host_target.pod_targets.each do |pod_target|
        if embedded_pod_targets.include? pod_target
          pod_target.specs.each do |spec|
            if spec.attributes_hash['ios'] != nil
              frameworkPaths = spec.attributes_hash['ios']['vendored_frameworks']
            else
              frameworkPaths = spec.attributes_hash['vendored_frameworks']
            end
            if frameworkPaths != nil
              frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|
                extension = File.extname filename
                File.basename filename, extension
              end
              frameworkNames.each do |name|
                puts "Removing #{name} from OTHER_LDFLAGS of target #{host_target.name}"
                config_file.frameworks.delete(name)
              end
            end
          end
        end
      end
      xcconfig_path = host_target.xcconfig_path(config_name)
      config_file.save_as(xcconfig_path)
    end
  end
end
PODS:
  - AppLovinSDK (11.4.3)
  - Google-Mobile-Ads-SDK (9.9.0):
    - GoogleAppMeasurement (< 10.0, >= 7.0)
    - GoogleUserMessagingPlatform (>= 1.1)
  - GoogleAppMeasurement (9.5.0):
    - GoogleAppMeasurement/AdIdSupport (= 9.5.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
    - GoogleUtilities/MethodSwizzler (~> 7.7)
    - GoogleUtilities/Network (~> 7.7)
    - "GoogleUtilities/NSData+zlib (~> 7.7)"
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - GoogleAppMeasurement/AdIdSupport (9.5.0):
    - GoogleAppMeasurement/WithoutAdIdSupport (= 9.5.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
    - GoogleUtilities/MethodSwizzler (~> 7.7)
    - GoogleUtilities/Network (~> 7.7)
    - "GoogleUtilities/NSData+zlib (~> 7.7)"
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - GoogleAppMeasurement/WithoutAdIdSupport (9.5.0):
    - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
    - GoogleUtilities/MethodSwizzler (~> 7.7)
    - GoogleUtilities/Network (~> 7.7)
    - "GoogleUtilities/NSData+zlib (~> 7.7)"
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - GoogleUserMessagingPlatform (2.0.0)
  - GoogleUtilities/AppDelegateSwizzler (7.7.0):
    - GoogleUtilities/Environment
    - GoogleUtilities/Logger
    - GoogleUtilities/Network
  - GoogleUtilities/Environment (7.7.0):
    - PromisesObjC (< 3.0, >= 1.2)
  - GoogleUtilities/Logger (7.7.0):
    - GoogleUtilities/Environment
  - GoogleUtilities/MethodSwizzler (7.7.0):
    - GoogleUtilities/Logger
  - GoogleUtilities/Network (7.7.0):
    - GoogleUtilities/Logger
    - "GoogleUtilities/NSData+zlib"
    - GoogleUtilities/Reachability
  - "GoogleUtilities/NSData+zlib (7.7.0)"
  - GoogleUtilities/Reachability (7.7.0):
    - GoogleUtilities/Logger
  - nanopb (2.30909.0):
    - nanopb/decode (= 2.30909.0)
    - nanopb/encode (= 2.30909.0)
  - nanopb/decode (2.30909.0)
  - nanopb/encode (2.30909.0)
  - PromisesObjC (2.1.1)
  - Protobuf (3.12.0)
  - UnityAds (4.3.0)
  - UnityMediationAdapter (3.0.1):
    - UnityMediationLogging (~> 1.0)
  - UnityMediationAdmobAdapter (1.0.0):
    - Google-Mobile-Ads-SDK (~> 9.0)
    - UnityMediationAdapter (~> 3.0)
    - UnityMediationSdk (>= 0.5)
  - UnityMediationAppLovinAdapter (1.0.0):
    - AppLovinSDK (~> 11.0)
    - UnityMediationAdapter (~> 3.0)
    - UnityMediationSdk (>= 0.5)
  - UnityMediationLogging (1.0.0)
  - UnityMediationSdk (0.5.1):
    - Protobuf (~> 3.12.0)
    - UnityMediationAdapter (~> 3.0)
    - UnityMediationLogging (~> 1.0)
  - UnityMediationUnityAdapter (1.0.0):
    - UnityAds (~> 4.1)
    - UnityMediationAdapter (~> 3.0)
    - UnityMediationSdk (>= 0.5)

DEPENDENCIES:
  - Protobuf
  - UnityMediationAdmobAdapter
  - UnityMediationAppLovinAdapter
  - UnityMediationSdk (~> 0.5.0)
  - UnityMediationUnityAdapter

SPEC REPOS:
  https://github.com/Unity-Technologies/unity-mediation-cocoapods-prod.git:
    - UnityMediationAdapter
    - UnityMediationAdmobAdapter
    - UnityMediationAppLovinAdapter
    - UnityMediationLogging
    - UnityMediationSdk
    - UnityMediationUnityAdapter
  trunk:
    - AppLovinSDK
    - Google-Mobile-Ads-SDK
    - GoogleAppMeasurement
    - GoogleUserMessagingPlatform
    - GoogleUtilities
    - nanopb
    - PromisesObjC
    - Protobuf
    - UnityAds

SPEC CHECKSUMS:
  AppLovinSDK: 221dfbdff620be0ff227ed5b018b97b1f3d15713
  Google-Mobile-Ads-SDK: 8822993da940ab920bad131b5bffce7eb3f62c6a
  GoogleAppMeasurement: 6ee231473fbd75c11221dfce489894334024eead
  GoogleUserMessagingPlatform: ab890ce5f6620f293a21b6bdd82e416a2c73aeca
  GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1
  nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
  PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
  Protobuf: 2793fcd0622a00b546c60e7cbbcc493e043e9bb9
  UnityAds: 53f7a71da8a16b3eedb57d3930e672687939f643
  UnityMediationAdapter: ea2a9f5510b4991ef981ea53469d32eeccd400a2
  UnityMediationAdmobAdapter: 28db62b82f399a63acae77c3ab8e969c0561b433
  UnityMediationAppLovinAdapter: a75f8426d06c71ded269e26ae31a8ca966d2df73
  UnityMediationLogging: af0274f8b544950228abd302e793d5f43404b770
  UnityMediationSdk: 44880c02548f05b0026a502440049c71159ce802
  UnityMediationUnityAdapter: 4b0c00cc3d630507d86b8dd2d33517504ecc5f43

PODFILE CHECKSUM: 60aa919e392ce2d837afa41147a1dfb0780624b9

COCOAPODS: 1.11.3

Thanks in advance

Maybe this thread can help you: unfortunately it has been closed and it looks like Unity staff didn’t investigate further.

I’m experiencing the same issue mentioned there - it looks like IAP/RemoteConfig/ExceptionReporting work properly nonetheless, despite the error being logged every time.
I’m not using Unity Ads anymore so I’m not able to tell you if mediation is working properly or not.

Unity 2020.3.39f1
RemoteConfig 3.1.3
IAP 4.4.1

Hi @Menion-Leah ,
This sounds like a problem initializing UGS. could you let us know what version of Services Core you have installed in package manager? There was an issue that was fixed some time ago, 1.4.0+ should definitely have the fix, unless it is a regression.

Hi @jcGrenier !

Sorry, I can’t find any Services Core in the package manager.
This is the list of the currently installed packages:

It seems like Mediation is not installed either.
Unfortunately I do not know for sure which package includes Core Services, or what version of it.
You can try going to package manager and clicking the little + at the top left, select add package by name, and add com.unity.services.core This should allow you to update to the latest services core package. If the issue persist I would recommend asking in the forum section related to the package you are trying to use. At a quick glance I would say it is likely the Analytics Library.

Thanks for the suggestions, @jcGrenier

Upon investigation, it looks like my current setup involves:

Using Services Core 1.4.0:

  • Analytics 4.0.1
  • Remote Config Runtime 3.1.3

Using Services Core 1.3.1 (1.4.0 installed):

  • Authentication 2.0.0
  • In App Purchasing 4.4.1 (latest verified version)

It looks like the initial assumption, mentioned in the closed thread I linked, was right: the problem lies in the In App Purchasing 4.4.1 release.
Unfortunately it’s the last one labeled as Verified, so updating it to a more recent version is not an option for us.

Furthermore, even updating to the latest In App Purchasing package version, it will still rely on the outdated Services Core package.

If I am not mistaken, if you have several dependencies on the same package, the highest version will be used. so here you see IAP depends on 1.3.1, but you have 1.4.0 installed, which should be good.
If I remember correctly Unity Mediation depends on core 1.4.0, and the issue you mentioned was resolved, so I would assume having 1.4.0 would resolve your issue?

If not please submit a log and I will pass it along to the services core team for further investigation.

Thank you for your support, @jcGrenier !

When running the game on a test device in order to collect related logs, I noticed the error disappeared.
The only relevant change since the last version affected by the issue was to remove the com.unity.ads package, version 3.7.5.
Hope that helps!

1 Like