iOS SDK Integration

Before you start

iOS version support is defined per network.  ironSource ads and LevelPlay mediation supports iOS versions 11+,  XCode version 14.3.1+.

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','7.9.0.0'
pod 'IronSourceAdQualitySDK','7.18.1'

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 7.9.0
    After you download the SDK; unzip it and add IronSource.xcframework into your Xcode Project.
  2. Download Ad Quality SDK
    After you download the SDK; unzip it and add IronSourceAdQualitySDK.xcframework into your Xcode Project.
  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”

If you are not using swift in your project, you need to make sure to add the following dependencies:

Go to Project➣BuildSettings ➣ Defines Module: Set to Yes 

Select Project➣BuildSettings➣Search path➣Library Search Paths, and add the code:

$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)
$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)

Then Project➣BuildSettings ➣ Linking ➣ Runpath search path and add the following code:

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

ProjectBuildSettings Build option Always embed swift standard libraries: Set to Yes

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

The ironSource SDK fires several events to inform you of your ad unit activity. To receive these events, register to the delegates of the ad units you set up on the ironSource platform.

Rewarded Video

[IronSource setLevelPlayRewardedVideoDelegate:yourLevelPlayRewardedVideoDelegate];
IronSource.setLevelPlayRewardedVideoDelegate(yourLevelPlayRewardedVideoDelegate)

Interstitial

[IronSource setLevelPlayInterstitialDelegate:yourLevelPlayInterstitialDelegate];
IronSource.setLevelPlayInterstitialDelegate(yourLevelPlayInterstitialDelegate)

Banner

[IronSource setLevelPlayBannerDelegate:yourLevelPlayBannerDelegate];
IronSource.setLevelPlayInterstitialDelegate(yourLevelPlayBannerDelegate)

Step 4. Initialize the ironSource SDK

      • ironSource supports optional SDK settings such as UserID and Segments that must be configured before you initialize the SDK. See our guide on Advanced Settings for setup instructions
      • If you plan to get user authorization (iOS 14) using a pop-up whenever your app is launched, we recommend that you perform this action before you init ironSource SDK. You can learn more about App Tracking Transparency on Apple’s documentation
      • If you don’t ask for user authorization (iOS 14) upon app launch, init the ironSource SDK immediately upon launch. 
      • If you’re using server-to-server callbacks to reward your users with ironSource SDK rewarded ad units, or using Ad Quality user journey, set the UserID

Init the SDK

You can initialize the SDK in two ways.

      1. We recommend this approach as it will fetch the specific ad units you define in the adUnits parameter. Ad unit is a string array.
        [IronSource initWithAppKey:YOUR_APP_KEY adUnits:YOUR_AD_UNITS];
        IronSource.initWithAppKey(kAPPKEY, adUnits:YOUR_AD_UNITS)

        Sample:

        [IronSource initWithAppKey:APP_KEY adUnits:@[IS_REWARDED_VIDEO]];
        /** or for all ad units
        [IronSource initWithAppKey:APP_KEY adUnits:@[IS_REWARDED_VIDEO,IS_INTERSTITIAL,IS_BANNER]];
         IronSource.initWithAppKey(kAPPKEY, adUnits:[IS_REWARDED_VIDEO];
        /** or for all ad units
        IronSource.initWithAppKey(kAPPKEY, adUnits:[IS_REWARDED_VIDEO,IS_INTERSTITIAL,IS_BANNER])

        When using this init approach, you can now initialize each ad unit separately at different touchpoints in your app flow in one session.

        // To init Rewarded Video
        [IronSource initWithAppKey:APP_KEY adUnits:@[IS_REWARDED_VIDEO]];
        //To init Interstitial
        [IronSource initWithAppKey:APP_KEY adUnits:@[IS_INTERSTITIAL]];
        // To init Banner
        [IronSource initWithAppKey:APP_KEY adUnits:@[IS_BANNER]];
        // To init Rewarded Video
        IronSource.initWithAppKey(kAPPKEY, adUnits:[IS_REWARDED_VIDEO])
        // To init Interstitial
        IronSource.initWithAppKey(kAPPKEY, adUnits:[IS_INTERSTITIAL])
        // To init Banner
        IronSource.initWithAppKey(kAPPKEY, adUnits:[IS_BANNER])

      2. Alternatively, you can init the SDK as detailed below and the SDK will init the ad units you’ve  configured on the ironSource platform:
        [IronSource initWithAppKey:YOUR_APP_KEY];
        IronSource.initWithAppKey(kAPPKEY)

Init Complete Callback

The ironSource SDK fires callback to inform you that the ironSource SDK was initialized successfully, for ironSource SDK 7.2.1+ . This listener will provide you an indication that the initialization process was completed, and you can start loading ads. The callback will be sent once per session, and will indicate the first initialization of the SDK.

[IronSource initWithAppKey:_appKey delegate:self];
#pragma mark -ISInitializationDelegate
// Invoked after init mediation completed
- (void)initializationDidComplete {
}
IronSource.initWithAppKey(kAPPKEY, delegate: self)
//MARK: ISInitializationDelegate Functions
/**
   called after init mediation completed     
*/
public func initializationDidComplete() {
         
}

Step 5. Verify Your Integration

The ironSource SDK provides an easy way to verify that your SDK and Mediation integration was completed successfully. To verify your ironSource SDK integration as well as any additional ad networks you have implemented, simply add this method to your project:

[ISIntegrationHelper validateIntegration];
ISIntegrationHelper.validateIntegration()

For more details on the ironSource Integration Verification tool navigate to this article.

Done! You just integrated the ironSource SDK in your app. 
You are now ready to start working with the Unity LevelPlay Ad Units and advanced mediation platform.


What’s Next?

Once you’ve verified your integration with the Integration Helper, follow the integration guides and implement our Ad Units:

Interested in the ironSource Mediation platform? Integrate our Rewarded Video or Interstitial Ads and follow our Mediation articles.

You can read this article in: