iOS SDK Integration

Before you start

iOS version support is defined per network. ironSource ads and LevelPlay mediation support iOS versions 12+, and XCode versions 15.4+.

To be compatible with iOS 14, ironSource released SDK 7+ with support for SKAdNetwork attribution. You can learn more about updating to SDK 7 here.

The download, use and access to the SDK is subject to the ironSource Platform Online Terms and Conditions. If you do not agree to the terms of ironSource Mobile SDK Publisher Online Terms & Conditions, do not download, access, or use the SDK, or the underlying services.

Step 1. Add the SDK to Your Project

ironSource SDK supports both Cocoapods and manual download mechanisms to integrate our SDK:

CocoaPods

CocoaPods is a dependency manager for Objective-C and Swift; it automates and simplifies the SDK integration process. See the CocoaPods Guide on Getting Started and Using CocoaPods for more information.

To integrate our SDK with Cocoapods, enter the following line in your podfile:

pod 'IronSourceSDK','8.5.1.0'

# Supports LevelPlay SDK version 8.5.0
pod 'IronSourceAdQualitySDK','7.22.3' 

To opt out Ad Quality from your project, remove the Ad Quality pod from the podfile section.

If you are not using swift in your project, go to Project➣BuildSettings ➣ Linking ➣ Runpath search path, and add the following code:

// needs to be first on the list 
/usr/lib/swift

Manual Download

Follow these steps to add the ironSource SDK to your project:

  1. Download iOS SDK Version 8.5.1
    After you download the SDK; unzip it and add IronSource.framework into your Xcode Project.
  2. Download Ad Quality SDK
    After you download the SDK; unzip the file and change IronSource.framework to IronSourceAdQualitySDK.xcframework
  3. Add Linker Flags
    Add the following linker flag to the build settings at:
    TargetBuild SettingsLinking Other Linker Flags:
    ObjC
  4. Import libraries – “z”,”sqlite3.0″
  5. Import frameworks –  “JavaScriptCore”,”WebKit”,”AdSupport”,”SystemConfiguration”

ironSource Mediation Demo App

The Integration Demo application demonstrate how to integrate Unity LevelPlay Mediation in your app.

Download iOS Demo Application

Step 2. Update Property List file (Info.plist)

SKAdNetwork Support

To enable the display of ironSource network ads while using SDK 7+, make sure to include the ironSource ad network ID in your app property list file (Info.plist). 

  1. Select Info.plist in the Project navigator in Xcode
  2. Click the Add button (+) beside a key in the property list editor and press Return
  3. Type the key name SKAdNetworkItems
  4. Choose Array from the pop-up menu in the Type column
  5. Create a dictionary item, and below it a single string item  
  6. Enter Key name SKAdNetworkIdentifier, and the key value:
    su67r6k2v3.skadnetwork

You can also add SKAdNetworkIdentifier to your Info.plist, by using this code: 

<key>SKAdNetworkItems</key>
<array>
   <dict>
      <key>SKAdNetworkIdentifier</key>
      <string>su67r6k2v3.skadnetwork</string>
   </dict>
</array>

For more information on editing the property list, see the Xcode documentation.

Universal SKAN Reporting

To receive copies of winning install-validation postbacks from all of the demand sources for your advertised app, add the NSAdvertisingAttributionReportEndpoint key in your app’s Info.plist.

  1. Select Info.plist in the Project navigator in Xcode
  2. Click the Add button (+) beside a key in the property list editor and press Return
  3. Type the key name NSAdvertisingAttributionReportEndpoint
  4. Choose String from the pop-up menu in the Type column
  5. Type the URL: https://postbacks-is.com 

Learn more about Universal SKAN reporting here.

App Transport Security Settings

To ensure uninterrupted support for ironSource ad delivery across all mediation networks, it’s important to make the following changes in your info.plist:

  • Add in a dictionary called ‘NSAppTransportSecurity‘. Make sure you add this dictionary on the ‘Top Level Key‘.
  •  Inside this dictionary, add a Boolean called ‘NSAllowsArbitraryLoads‘ and set it to YES.ats
Note:
  • Make sure that your info.plist does not contain any other exceptions besides ‘NSAllowsArbitraryLoads‘, as this might create a conflict.
  • Find more information on ATS here.

Step 3. Set The Delegates

Import the necessary files

#import "IronSource/IronSource.h"

Download the IronSource.h file. Then, go to Targets ➣ Build Settings ➣ Objective-C Bridging Header and add the path to your bridging header file.

For Swift, find detailed instructions and download the header file here.

Set Delegates

  • For Rewarded Video

Rewarded Video ad unit uses the Legacy ironSource SDK. To receive events which inform you of your ad unit activity, register to the delegates of the Rewarded Video ad unit you set up on the LevelPlay platform.

Make sure you set the rewarded video delegates before initializing the SDK, to avoid any loss of information.

[IronSource setLevelPlayRewardedVideoDelegate:yourLevelPlayRewardedVideoDelegate];
IronSource.setLevelPlayRewardedVideoDelegate(yourLevelPlayRewardedVideoDelegate)
  • For Interstitial and Banner

Interstitial and Banner ad units use the LevelPlay Multiple Ad Unit SDK. Please check their integration guides for ad delegates implementations.

Step 4. Initialize the ironSource SDK

    Init the SDK

    To initialize the ironSource SDK, follow these steps:

    1. Define the list of ad formats to initialize in the session. This should include REWARDED, as it’s not officially supported for Multiple Ad Units API. 
    2. Call the LevelPlay init API using the appKey, ad formats, and user ID if relevant.
    3. Define the completion handler success and failure.
    User ID

    Add the user ID as part of the initialization request builder if you’re using server-to-server callbacks to reward your users, or using Ad Quality user journey

        // Create a request builder with app key and ad formats. Add User ID if available
        LPMInitRequestBuilder *requestBuilder = [[LPMInitRequestBuilder alloc] initWithAppKey:@"appKey"];
        [requestBuilder withLegacyAdFormats:@[IS_REWARDED_VIDEO]];
        [requestBuilder withUserId:@"UserId"];
    
        // Build the initial request
        LPMInitRequest *initRequest = [requestBuilder build];
        // Initialize LevelPlay with the prepared request
        [LevelPlay initWithRequest:initRequest completion:^(LPMConfiguration *_Nullable config, NSError *_Nullable error){
        
            if(error) {
                // There was an error on initialization. Take necessary actions or retry
            } else {
               // Initialization was successful. You can now create ad objects and load ads or perform other tasks         }
        }];
        // Create a request builder with app key and ad formats. Add User ID if available
        let requestBuilder = LPMInitRequestBuilder(appKey: "appKey")
                .withLegacyAdFormats([IS_REWARDED_VIDEO])
                .withUserId("UserId")
        // Build the initial request
        let initRequest = requestBuilder.build()
        // Initialize LevelPlay with the prepared request 
        LevelPlay.initWith(initRequest) 
        { config, error in
            if let error = error {
                // There was an error on initialization. Take necessary actions or retry
            } else {
                // Initialization was successful. You can now create ad objects and load ads or perform other tasks
          }
    }

    Initialization result

    Success – triggered when the initialization is completed successfully. After you receive this indication, you can create and load the ad.

    Error – the configuration was not retrieved successfully and ads cannot be loaded. It is recommended to try and initialize the ironSource SDK later (when internet connection is available, or when the failure reason is resolved)

    Step 5. Verify Your Integration

    The ironSource SDK provides an easy way to verify that your integration was completed successfully with the LevelPlay integration test suite. Test your app’s integration, verify platform setup, and review ads related to your configured networks. 

    To enable the test suite in your app, call the setMetaData API before setting the init:

    [IronSource setMetaDataWithKey:@"is_test_suite" value:@"enable"];

    After mediation init is completed successfully, launch the test suite by calling the following method:

    [IronSource launchTestSuite:self];

    For more details and an implementation example of the LevelPlay integration test suite navigate to this article.

    Done! You just integrated the ironSource SDK in your app. 
    You are now ready to start working with Ad Units and Mediation Tools.


    What’s Next?

    1. Follow our integration guides to implement ad formats
    2. Interested in Mediation? Integrate our Rewarded Video, Interstitial or Banner Ads in your app and follow our Mediation articles.
    3. Verify your integration with our Integration Test Suite.
      You can read this article in: