Integrating the iOS SDK

This guide describes how to integrate the DT Exchange SDK into your iOS project, which uses CocoaPods for dependency management.

Integrating with CocoaPods

CocoaPods enables you to add and manage external libraries. To integrate via CocoaPods:

  1. Open a terminal and navigate to your project directory.

  2. Run the following command to create a new Podfile if you don't already have one:

Bash
pod init
  1. Edit the Podfile and add the DT Exchange pod to the desired target:

Bash
pod 'Fyber_Marketplace_SDK'
  1. To install and update the repository, run the following command. The pod install command installs the SDK and its dependencies and creates a new .xcworkspace file for use with Xcode:

Bash
pod install --repo-update
  1. To import the IASDKCore into the AppDelegate class, run the following command:

Objective-C
[IASDKCore.sharedInstance setGDPRConsentString:@"abcdef"];

Downloading and Setting Up the SDK

To download the DT Exchange iOS SDK, click here:

↓ iOS DTX SDK 8.4.6
circle-check

Starting the Process

Step 1: Integrating the Libraries

  1. Drag the IASDKCore library to your Xcode project. The Choose options for adding these files pop-up screen appears.

  2. Select the Copy items if needed and Create Groups checkboxes.

  3. From Application targetBuild Phases, click Link Binary With Libraries to verify that the app target is linked with the IASDKCore library.

  4. If missing, drag the IASDKCore library to the Link Binary With Libraries section. This links your project with the IASDKCore library and adds a required path to the Framework Search Paths.

  5. Import the IASDK into the AppDelegate class:

Step 2: Initializing the SDK

SDK initialization is mandatory because the DT SDK relies on the console configuration for functionality. Without it, the SDK won't operate, and no ads will display. DT recommends performing this step during the app's initialization.

The following takes place during the initialization phase:

  • Initialization of SDK.

  • Remote configuration fetching, parsing, loading, and local configuration update.

  1. Add the following code inside the method in the AppDelegate class.

  1. Run the following command:

circle-check
circle-check

Step 3: Configuring Apple Requirements

Adhering to Apple's requirements ensures that your app complies with its privacy guidelines, as described in ATS Configuration for DT Exchange SDK.

Configuring Tracking Permission Alerts with ATT Framework

App Tracking Transparency (ATT) allows you to request user consent for tracking. You must use the ATT framework and provide your users with an authorization request within your app only if you want to receive consent and access a non-zero IDFA from the device. For more information, see App Tracking Transparencyarrow-up-right.

circle-info

Calling requestTrackingAuthorization(completionHandler:) prompts the end user for app-tracking authorization. If the user disables tracking, the IDFA is set to zero.

SKAdNetwork Attribution Solution

The SKAdNetwork APIarrow-up-right enables advertisers to measure app installs in a privacy-aware manner. Configuring SKAdNetwork IDs is crucial to monetizing with DT Exchange since it allows DSPs to credit your app with installs. DT recommends that you include SKAdNetwork IDs in the info.plist file to maximize revenue potential.

Getting the SKAdNetwork IDs

The SKAdNetwork IDs for DT and DT buyers are available in two regularly updated formats. Select one of the following links to retrieve the latest SKAdNetwork IDs:

Configuring the SKAdNetwork IDs

The SKAdNetwork helps track app installs in a privacy-friendly way. To configure your app with SKAdNetwork IDs:

  1. Select Info.plist from the Project navigator in Xcode.

  2. In the property list editor, click Add (+) beside a key and press Return.

  3. In the field, type the key name: SKAdNetworkItemsarrow-up-right.

  4. From the pop-up menu in the Type column, select Array.

  5. Create an array that contains one dictionary for each of DT's recommended SKAdNetwork IDs with the single-key: SKAd Network Identifierarrow-up-right. The string value for the key is the ad network identifier.

SKAdNetwork ID Manager

The SKAdNetwork IDs Manager tool identifies and manages SKAdNetwork IDs. This tool processes and deduplicates SKAdNetwork IDs for all buyers on DT Exchange and then generates a finalized Info.plist;output for streamlining integration into your app. The tool enables you to add other SKAdNetwork IDs to your final Info.plist file.

circle-check

To configure SKAdNetwork IDs, see Configuring a Source Apparrow-up-right.

Step 4: Adding Delegates

Delegates manage various events and interactions related to ads. Depending on your integration, you may need to add the following delegates to your iOS integration:

  • Global Ad Delegate Protocol

  • Unit Delegate

  • Video Content Delegate

  • HTML / MRAID Delegate

For further information, see Delegate Protocols.

Step 5: Adding User Consent

User consent mechanisms comply with various data protection laws. The following regulations mandate that users' data be handled with explicit consent:

GDPR

The General Data Protection Regulation (GDPRarrow-up-right) of the European Union requires you to implement a user consent mechanism. A user could be within the GDPR scope for your app when one or all of the following apply:

  • The user is currently located in the EU.

  • The user has registered with the app as an EU resident.

  • The app is specifically targeted to EU users.

To comply with EU regulations and ensure seamless ad monetization, DT recommends consulting a legal advisor to determine the best approach for your business and using a Consent Management Platform (CMP).

If you haven’t updated to SDK 8.3.1 or later, you need to manually configure consent values with your CMP. The SDK automatically retrieves these values from 8.3.1 and later, eliminating the need for manual setup. For a complete list of CMPs, see the Interactive Advertising Bureau - CMP Listarrow-up-right.

To incorporate GDPR consent values, run the GDPRConsent API in Boolean format, for example:

Valid values:

  • True: The user grants consent.

  • False: The user does not grant consent.

circle-exclamation

To set the GDPR consent string, use the following API:

CCPA

The California Consumer Privacy Act of 2018 (CCPAarrow-up-right) protects the personal information of California residents and applies to all companies operating in California. If a California resident uses a mobile app developer's app, CCPA applies to the developer and every company that processes the personal information of the app's users. For more information on CCPA, see IAB CCPA Compliance Frameworkarrow-up-right.

To set the CCPA consent string, use the following API:

DT supports the following values for the US Privacy String:

  • 1---: CCPA does not apply, for example, the user is not a California resident.

  • 1YNN: User does NOT opt out, ad experience continues.

  • 1YYN: User opts out of targeted advertising.

For more information, see US Privacy IAB documentationarrow-up-right.

To clear the CCPA-provided data, pass a nil value and use the following Clear Privacy Setting:

circle-check

LGPD

The Brazilian General Data Protection Law, the Lei Geral de Proteção de Dados Pessoais (LGPDarrow-up-right), mandates processing personal data for legitimate, specific, explicit, and communicated purposes.

To set the LGPD consent value, use the following API:

Valid values:

  • IALGPDConsentTypeGiven: User grants consent.

  • IALGPDConsentTypeDenied: User does not grant consent.

If the consent value is not set, the default is no consent.

COPPA

The Children's Online Privacy Protection Act of 1998 (COPPAarrow-up-right) is a federal law that imposes specific requirements on websites and online service operators to protect the privacy of children under 13.

COPPA API for Flagging Specific Users

iOS SDK 8.2.1+ supports the COPPA API, which allows publishers to flag specific end users as children as required under COPPA. It is the Publisher's responsibility to decide whether to use the COPPA API or to treat all users as children. For instructions on flagging all users as children, see COPPA.

iOS SDK 8.2.1+ supports the COPPA API, which allows publishers to flag specific end users as children as required under COPPA. It is the publisher’s responsibility to decide whether to use the COPPA API or to treat all users as children. For COPPA configuration options, see COPPA.

Important

circle-exclamation

To confirm that the target audience of the application applies to COPPA, use the following API:

GPP

The IAB Global Privacy Protocol (GPParrow-up-right) is a standardized framework for managing and transmitting user consent and privacy signals across the digital advertising ecosystem.

GPP is supported starting with iOS SDK 8.4.6. For more information, see GPP.

Step 6: (Optional) Setting User IDs

This section describes how to set a User ID that is cached on the device and does not need to be passed in every session.

Setting a User ID

The User ID is sent as is, without validation or modification. To reset the User ID on a device, pass a nil or an empty string in the following format.

Setting Introspection (reflection) Integration

To run an integration using introspection (reflection), run the following script:

Last updated