Integrating the iOS SDK

Integrating with Cocoapods

Follow these steps to integrate via Cocoapods:

  1. Open a terminal
  2. Navigate to your project folder
  3. Create a new pod file, if  you don't already have one:
pod init
  1. Add DT Exchange pod to desired target:
pod 'Fyber_Marketplace_SDK'
  1. Run install:
pod install --repo-update
  1. After the pods have been installed, the ongoing work with Xcode should happen via its workspace file and not project file.

  2. Import the IASDKCore into the AppDelegate class:

Objective-C

#import <IASDKCore/IASDKCore.h>

Downloading the SDK

To download the DT Exchange iOS SDK, click here:

iOS Download Button

The DT Exchange SDK Zip folder contains a test app that publishers can use for reference on how to integrate the SDK, how ads from DT Exchange appear or to troubleshoot issues.

Starting the Process

  • If you are using the Cocoapods Dependency Manager, click here, afterwards you can immediately skip to Step 2.
  • The DT iOS SDK requires, at minimum, an iOS 11 target and is fully compliant with iOS 17.

Step 1: Integrating the Libraries

  1. Drag the IASDKCore library to your project.

     

  1. Xcode displays a popup, asking for more details about what to do with the dropped folder.

Make sure that the Copy items if needed and Create Groups is selected in your application's target in the Add to targets section.

 

  1. Verify the linkage of the app target with the IASDKCore library by clicking your application target -> Build Phases -> Link Binary With Libraries.
  2. If missing, drag the IASDKCore library to the Link Binary With Libraries section. This links your project with IASDKCore library and adds a required path to the Framework Search Paths.
  3. Import the IASDK into the AppDelegate class:
#import <IASDKCore/IASDKCore.h>

Step 2: Initializing the SDK

Add the the following line of code inside the method of the AppDelegate class:

application:didFinishLaunchingWithOptions:launchOptions

Initializing the SDK

[IASDKCore.sharedInstance initWithAppID:@"YOUR APP ID"
                        completionBlock:^(BOOL success, NSError * _Nullable error) {}
                        completionQueue:nil];

For details of advanced SDK init integration, click here.

Initialization is an expensive operation. We recommend performing it at the initialization stage of the app.

We defined the initialize process as mandatory because the DT SDK relies on the Console configuration. Without this configuration, no ad unit is shown and the SDK will not work.

The following takes place during the initialization phase:

  • Initialization of SDK
  • Remote configuration fetching, parsing, loading and local configuration update.

All Publisher (client side) Ad Requests are on hold until the configuration is loaded to memory. The requests resume asynchronously once the config is ready. If a timeout occurs, the Publisher receives an ad failed event.

Step 3: Apple Requirements

There are some additional Apple Requirements.  Click here to review the requirements.

Configuring Tracking Permission Alerts With ATT Framework for iOS 14+

The AppTrackingTransparency (ATT) framework works by presenting an app-tracking authorization request to the user. The tracking authorization status is then returned based on the user's selection.

According to Apple, apps must use the AppTrackingTransparency framework if they collect data about end-users and share this with other companies for purposes of tracking across apps and websites.

DT uses the ATT framework, in iOS 14 and above, to retrieve users' authorization statuses.  For more information about ATT, click here

SKAdNetwork Attribution Solution

Apple created the SKAdNetwork API for advertisers to measure app installs in a privacy-aware manner in iOS 14 and above. Configuring SKAdNetwork IDs is a crucial aspect of monetizing with DT Exchange since it allows our DSPs to credit your app with installs. It is highly encouraged that all of DT's recommended SKAdNetwork IDs are added to your info.plist to maximize your revenue potential.

Getting the SKAdNetwork IDs

The SKAdNetwork IDs for both DT and DT buyers are available in two formats. These files are regularly updated.  The most up-to-date SKAdNetwork IDs can be found here:

Configuring the SKAdNetwork IDs 

To configure your app with SKAdNetwork IDs,

  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 an array that contains one dictionary for each of DT's recommended SKAdNetwork IDs using the single key  SKAd Network Identifier . The string value for the key is the ad network identifier.

SKAdNetwork ID Manager

To discover the SDAdNetwork IDs, you can also use DT's SKAdNetwork IDs Manager. This tool processes and deduplicates SKAdNetwork IDs for all buyers on DT Exchange, and then generates a finalized Info.plist output for you, for easy integration into your app. The tool also lets you add any other SKAdNetwork IDs you have to your final Info.plist

You must use lowercase for the ad network identifier string.

For more information, refer to the Apple specification for configuring SKAdNetwork IDs.

Step 4: Adding Delegates

Depending on your integration, you must add delegate information to your iOS integration at this point.

Different delegates are required. Have a look below and select the necessary delegates.

Click here for details of: 

  • Global Ad Delegate Protocol
  • Unit Delegate
  • Video Content Delegate
  • HTML / MRAID Delegate

Step 5: Adding User Consent

Review the below GDPR related instructions (available starting iOS v7.0.8 SDK and legacy version v6.4.6) 

GDPR

The General Data Protection Regulation of the European Union requires you to scope your user's consent. 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

When you set a GDPR consent value for a user, DT concludes that you have decided that the user is subject to GDPR rules, even if the user is outside Europe. If, based on your legal position, your non-EU users are not subject to GDPR, do not pass any consent value for them.

We recommend you consult with a legal advisor to determine the best approach for your business. It is also highly recommended to collect user consent with a certified Consent Management Platform (CMP).

For a full list of CMPs, click here.

Once you have collected the user’s consent, you can pass it into the SDK using the following API of setGDPRConsent:, e.g:

[IASDKCore.sharedInstance setGDPRConsent:YES]

GDPRConsent format is  boolean. It is true if you have the user’s consent. If you do not have the user's consent, it is false.

It is highly recommended to use the 2nd option of passing a consent string per the IAB's Transparent & Consent Framework by using a valid CMP (Consent Management Platform). This is the most common form of consent communication worldwide and is crucial in order to enjoy ad monetization in the EU.

We recommend that the first time you gather the user’s consent, you pass it onto the SDK before starting the SDK. The SDK then takes the user’s consent into consideration when initializing. In the following sessions, you need only call the API if the user updates their consent.

Setting Consent String

To set the GDPR Consent String, use the: setGDPRConsentString:
The consent string is passed as is.

Example

[IASDKCore.sharedInstance setGDPRConsentString:@"abcdef"];

GDPRConsentString format is  string.

More information on GDPR can be found under the GDPR Resource Page and FAQs.

CCPA

The intention of the California Consumer Privacy Act of 2018 (CCPA) is to protect the personal information of California residents. CCPA applies to all companies doing business in California. If a California resident uses an app developer’s mobile app, CCPA applies to the developer and every company that processes the personal information of the app’s users.
CCPA came into effect on 1 January 2020.

For more information on DT and CCPA, refer to DT's Resource Page.
For more information about CCPA, refer to the IAB CCPA Compliance Framework.

CCPA API

Once you have the CCPA string, you can pass it to the SDK using the following API:

API

`IASDKCore.sharedInstance.CCPAString = `

Example

IASDKCore.sharedInstance.CCPAString = @"1YNN";

To determine what value to use for the US Privacy String, refer to the IAB document here.
Example values:

  • When CCPA does not apply (for example if the user is not a resident of California) you can either skip this API or use the following value 1---
  • If the user choses NOT to opt out, and is ok with advertising as usual, you can use 1YNN
  • If the user chooses to restrict advertising and opt out, you can use 1YYN

To clear the CCPA provided data, just pass a nil.

Clear Privacy Setting

IASDKCore.sharedInstance.CCPAString = nil;

The DT Exchange SDK does not validate the provided CCPA string and passes it as is.

LGPD

The Brazilian General Data Protection Law, the Lei Geral de Proteção de Dados Pessoais (LGPD) requires that you only process personal data for legitimate, specific, explicit and clearly communicated purposes.

Use the following API to enable publishers to set the LGPD consent value:

Swift Objective-C
IASDKCore.sharedInstance().lgpdConsent = .given
IASDKCore.sharedInstance().lgpdConsent = .denied

The accepted values are:

IALGPDConsentTypeGiven=consent was given, IALGPDConsentTypeDenied=no consent

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

COPPA

The Children's Online Privacy Protection Act of 1998 (COPPA) is a federal law that imposes specific requirements on operators of websites and online services 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, click here.

Important

  • Calling the COPPA API must be performed after a successful initialization of the DT SDK
  • You must pass the COPPA state after every successful init of the SDK

Use the following API to confirm that the target audience of the application applies to COPPA:

Swift Objective-C
IASDKCore.sharedInstance().coppaApplies = .given

Step 6: Setting a User ID (Optional)

Follow these steps for setting a User ID.

Setting a User ID

We have added an API for setting a User ID.

There is no need to pass it on every session as we cache it on the device.

The User ID is sent, as is. There is no validation/modification.

To reset it from a device, pass a nil or an empty string.  The User ID is sent as is, without any validation or modification. 

Objective-C
@property (atomic, nullable) NSString *userID;

Example:

Objective-C
IASDKCore.sharedInstance.userID = @"User_123456";

Introspection (reflection) Integration

Objective-C
Class IASDKCore = NSClassFromString(@"IASDKCore");
SEL sharedInstanceSelector = NSSelectorFromString(@"sharedInstance");
SEL setUserID = NSSelectorFromString(@"setUserID:");
id sharedInstance = [IASDKCore performSelector:sharedInstanceSelector];

[sharedInstance performSelector:setUserID withObject:@"User_123456"];

Back to Top ⇧