Installing and configuring the SDK

Integration Guide.

Release version 1.7.2 | Release date 05/15/2025

Minimum requirements:

  • iOS 13.0 and above.

  • Use Xcode 13 and above.

Demo application

Use our demo application as an example.

Installation

General description of the installation process

To install the iOS SDK, you will need:

  • Check out the demo application

  • Finalize the Podfile of your project

  • Run pod install in the project folder

  • Check the installation correctness by initializing the SDK with debug mode enabled

Podfile Configuration

  1. Add dependencies to your Podfile for the installation of all necessary adapters. The account manager at Madex will provide you with a full list of dependencies along with the current version numbers for libraries and adapters. Example dependencies for Madex, Yandex, IronSource, and Mintegral networks:

platform :ios, "13.0"

target "Sample" do
    use_frameworks!
    
    # connection of Madex SDK dependency
    pod "MadexSDK", "1.7.2"
    
    # connection of Applovin SDK advertising network dependency
    pod "SspnetApplovinAdapter", "1.4.0"
    
    # connection of IronSource SDK advertising network dependency
    pod "SspnetIronSourceAdapter", "1.4.0"
    
    # connection of Yandex SDK advertising network dependency
    pod "SspnetYandexAdapter", "1.4.0"
    
    # connection of Mintegral SDK advertising network dependency
    pod "SspnetMintegralAdapter", "1.4.0"
end
  1. Save the file and open the terminal in the project folder.

  2. Run the command pod install in the terminal to install the dependencies.

Use the pod update command to update dependencies.

Add the Applovin SDK key

If you are using an adapter for Applovin, then add the following key to the Info.plist:

<key>AppLovinSdkKey</key>
<string>APPLOVIN_SDK_KEY</string>

You can copy your APPLOVIN_SDK_KEY in the "Keys" section of your Applovin personal account.

Installation check

To make sure that the SDK is installed correctly, you will need to enable debug mode and initialize the SDK.

Debug mode

In debug mode SDK logs errors and events. It is disabled by default.

Use the enableDebug method to enable debug mode.

Madex.enableDebug(true);

Initialization

Use the code below to initialize the SDK in your project.

You can copy your publisher_id in the "Settings" section of your Madex personal account.

Madex.initialize(publisherID: "publisher_id") { error in
    if let error {
        // Called when the SDK is installed correctly
        // Using AdException error, you can get detailed information about the error
    } else {
        // Called when an error occurred during SDK installation  
    }
}

If the SDK is installed correctly, you will see the following message in the console.

SDK initialized(<Madex SDK version number>)

Done! The SDK is installed, you can proceed to setting up ads.

We recommend that you don't disable debug mode until you finish working with ads.

If the SDK is installed incorrectly

In case of errors, we recommend clearing the CocoaPods cache.

The command to clear the cache is provided below.

rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update

If this doesn't help, try installing the SDK in a clean project. If the SDK is installed correctly, try to debug errors in your project.

We also recommend to take a look at the installation and initialization in the demo application.

If you are unable to install the SDK correctly and the above steps didn't lead to successful initialization, please contact support.

Additional actions to increase revenue

Setting Up Apple ID

For more effective targeted advertising and increased revenue, Madex SDK collects and transmits user App ID data - a unique numerical application identifier from the Apple AppStore.

It is determined automatically, but in some cases, Madex SDK may not be able to determine it.

If Madex SDK did not determine your App ID, you will see the following message in the console.

AppStore ID is nil. You must set AppStore ID manually.

In this case, you need to set the ID manually.

To set up Apple ID, use the setCustomParams method.

Madex.setCustomParams("appStoreAppID", "apple_id")

Replace apple_id with your App ID from the AppStore developer account. You can find it on the app page in the developer account.

Using an Apple ID in the AppStore Connect

Apple Advertising Identifier (IDFA)

For more effective targeted advertising and increased revenue, you can collect the Apple device advertising identifier and pass it to Madex SDK.

To enable IDFA collection, add descriptions for the following permissions to the Info.plist file:

NSUserTrackingUsageDescription - Permission to collect the advertising identifier (Advertising Identifier IDFA).

The sample code in the Info.plist file is provided below.

<key>NSUserTrackingUsageDescription</key>
<string>We need this permission for better ad targetting</string>

Geolocation data collection

To make targeted ads work more effectively and increase revenue, you can collect in app data about a user's exact and/or approximate geolocation, and feed it into the Madex SDK.

To enable data collection, add descriptions for the following permissions to the Info.plist file:

NSLocationWhenInUseUsageDescription - Permission to collect user geolocation.

The sample code in the Info.plist file is provided below.

<key>NSLocationWhenInUseUsageDescription</key>
<string>We need this permission for better ad targetting</string>

Other SDK settings

In order to comply with the requirements of the app store and the laws governing the collection, processing and use of user's personal data, it is required to obtain his consent to the above actions.

Usually, the user's consent is obtained on a special screen when the application is first launched — consent-screen.

The Madex SDK implements such a screen, you can add and configure it using the Content Manager library.

You can find out more about its installation and configuration in the corresponding section.

User Consent Screen

Last updated