Import and configure the Unity Mediation SDK

Import the Unity Mediation SDK in your project through CocoaPods by following these steps.

  1. Add the following source lines at the top of your Podfile:

  2. Copy
    source 'https://github.com/CocoaPods/Specs.git'
    source 'git@github.com:Unity-Technologies/unity-mediation-cocoapods-prod.git'
  3. Add the following line to your target to install the Unity Mediation SDK:

  4. Copy
    pod 'UnityMediationSdk'
  5. Add the following lines to include all ad network adapters, ensuring the dependencies of the adapters you intend to use in your project are declared:

    Copy
    pod 'UnityMediationUnityAdapter'
    pod 'UnityMediationAdColonyAdapter'
    pod 'UnityMediationAdmobAdapter'
    pod 'UnityMediationAppLovinAdapter'
    pod 'UnityMediationFacebookAdapter'
    pod 'UnityMediationIronSourceAdapter'
    pod 'UnityMediationVungleAdapter'

The following code is an example of a podfile after you add the Unity Mediation SDK and ad network adapters:

Copy
platform: ios, '9.0'
use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'
source 'git@github.com:Unity-Technologies/unity-mediation-cocoapods-prod.git'

target 'MyProject'do
  pod 'UnityMediationSdk'
  pod 'UnityMediationUnityAdapter'
  pod 'UnityMediationAdColonyAdapter'
  pod 'UnityMediationAdmobAdapter'
  pod 'UnityMediationAppLovinAdapter'
  pod 'UnityMediationFacebookAdapter'
  pod 'UnityMediationIronSourceAdapter'
  pod 'UnityMediationVungleAdapter'
end

After you set up your podfile by following the preceding steps, install the pods by using the cocoapod command:

Copy
pod install

Import ad network adapters

To implement a third-party ad network adapter, you need to configure third-party ad networks as sources in your mediation setup in the Unity Dashboard.

Note: If you use Unity Ads exclusively, no additional configuration is needed.

The following adapters require additional steps to function correctly in your app. If these requirements are not fulfilled, your app will not open and your builds will crash:

  • AdMob requires unique identifiers for each platform. You can locate these IDs in the AdMob dashboard, as detailed in the Ad Source Configuration guide.

  • Unity Ads requires that you remove any previous installations of the Unity Ads SDK