Installing the Unity Ads SDK for iOS

To install Unity Ads, you can use CocoaPods for UnityAds or you can manually install Unity Ads.

CocoaPods

To use CocoaPods for UnityAds:

  1. Add the following line to your project's Podfile:

    pod 'UnityAds'

  2. Run the following command:

    pod install

Manual installation

To manually install Unity Ads:

Note: This integration method requires that you set the Framework Search Paths and Header Search Paths properties in your Build settings.

  1. Download the Unity Ads framework from the Assets section of your preferred SDK release. It's recommended to download the latest SDK to ensure you have the best available support.
  2. Drag and drop the Unity Ads framework into your workspace.

Important: Projects that target users running iOS 14 or later must implement Unity Ads' network ID in the information property list file (Info.plist).

Swift

Starting in SDK version 4.4.0, Unity Ads has been optimized by using the Swift programming language.

  • If your project already uses Swift, then no further action is required.
  • If your project does not use Swift, add an empty Swift file to your project in Xcode by selecting File > New > Swift file.

Note: If your project is targeting an iOS version earlier than 12.4, ensure that you set the Always embed Swift standard libraries setting to YES under the Build settings of your application's target in Xcode.

Troubleshooting Swift interoperability errors

The following list details common Swift interoperability issues that could occur during the Unity Ads SDK installation:

  • Xcode emits many Undefined symbol_swift_FORCE_LOAD$_ errors.

    • To fix this, add an empty Swift file to your project in Xcode by selecting File > New > Swift file.
  • The application crashes after start with the error: dyld: Library not loaded: @rpath/libswiftCore.dylib

    • To fix this, ensure that you set Always embed Swift standard libraries to YES under Build settings for your application's target in Xcode.

Next steps

To continue your integration, refer to the Initializing the SDK in iOS documentation.