This is one of four guides that walk you through integrating the DT FairBid SDK with an iOS app:
- iOS SDK Integration (this guide)
- Setting-Up DT Fairbid (in the DT Console)
- Initializing the SDK
- iOS Ad Formats (adding the ads to your app)
Current SDK Version
- 3.54.0
Note that since version 3.41.0 DT FairBid and DT Offer Wall are integrated through the same SDK - the DT FairBid SDK.
Prerequisites
- Xcode 14.1+
- iOS 11+
Integration
There are three frameworks required to integrate into your app:
- FairBid SDK
- FMPAdapter.framework
- IASDKCore.framework
Digital Turbine supports both CocoaPods and manual download to integrate our SDK:
CocoaPods
Add the following line to your Podfile and run the pod install command
pod 'FairBidSDK', '~> 3.54.0'
Manual Download
- Download the DT FairBid SDK
- Extract it
- Drag and drop FairBidSDK.framework to your project. Ensure "Copy items if needed" is checked
- Download the FMPAdapter here
- Drag and drop FMPAdapter.framework to your project. Ensure "Copy items if needed" is checked
- Retrieve the IASDKCore.framework from here:
- Download the SDK manually
- Open the folders: DTExchangeSDK-iOS -> IASDKCore -> IASDKCore.xcframework
- Drag and drop IASDKCore.framework to your project. Ensure "Copy items if needed" is checked
- From the General tab of your Xcode project's target settings page, ensure DT FairBidSDK, FMPAdapter and IASDKCore frameworks are embedded into your app under "Embed & Sign"
Configuring Your Xcode Project
The next step in the process is to configure your Xcode Project. There are 5 configurations to consider:
- Importing System Frameworks
- Disable Multitasking
- Strip Linked Products Build Flag
- App Transport Security
- Enabling Global Permissions
Importing System Frameworks
If the "Enable Modules" (CLANG_ENABLE_MODULES) option is active in the project's Build Settings, there's no need to import any frameworks manually. All you have to do is to import the DT FairBid framework umbrella header in your code, for example in the AppDelegate class:
#import <FairBidSDK/FairBidSDK.h>
import FairBidSDK
If you cannot enable modules, you might need to add these frameworks to the Frameworks, Libraries and Embedded Content section in Xcode:
AdSupport;
CoreGraphics;
CoreLocation;
CoreTelephony;
MediaPlayer;
MessageUI;
MobileCoreServices;
QuartzCore;
Security;
StoreKit;
SystemConfiguration;
Disable Multitasking
From the General tab of your Xcode project's target settings page, check the box labeled Requires full screen (this disables multitasking support, which must be disabled for ads to be able to set the orientation of their views):
Strip Linked Products Build Flag
By default, Xcode strips libraries linked to the project. This may result in symbols missing for some ad networks and subsequently, the DT FairBid SDK may not behave as expected.
To avoid this, set Strip Linked Products (STRIP_INSTALLED_PRODUCT) build flag to No:
App Transport Security
iOS 9 added App Transport Security (ATS), which requires apps to use HTTPS for all networking. As of 2017, Apple requires that all apps use ATS unless they state a reason due to which they are unable to do so.
All of the 3rd party networks that can be used with DT FairBid fully support ATS, and do not require any additional configuration.
Important
Starting from iOS 10.0, if the following two keys are present in the info.plist,
- NSAllowsArbitraryLoadsInWebContent
- NSAllowsArbitraryLoads
Then NSAllowArbitraryLoadsInWebContent will override NSAllowsArbitraryLoads. If you require global permission, keep only the NSAllowArbitraryLoads with YES in your .plist file, and delete the NSAllowArbitraryLoadsInWebContent key.
The same applies for the following keys:
- NSAllowsArbitraryLoadsForMedia
- NSAllowsLocalNetworking
In addition, it is important to understand that the NSAllowsArbitraryLoadsForMedia does not exclude VAST videos, in terms of ATS. It does not have any effect on the DT Exchange SDK, and only overrides the global NSAllowsArbitraryLoads key, which results in a secure request, even when it was not intended to do so.
Enabling Global Permissions
To enable a global permission to a non-secured HTTP request, add the following key and value to your Info.plist file, by opening the file as a property list:
Property list
*Key* App Transport Security Settings *Type* Allow Arbitrary Loads *Value* YES
Alternatively, you can add xml directly to the source code of the file - Info.plist:
XML
NSAppTransportSecurity NSAllowsArbitraryLoads
After adding the ATS to the file - Info.plist, it should look like this:
Adding 3rd Party SDKs
In addition to integrating the DT FairBid SDK, publishers who are using DT FairBid Mediation, must integrate chosen 3rd-party networks' SDKs into their app.
- Set up your app in the network's dashboard and in the DT Console. A step-by-step guide can be found here.
- Download the relevant network's SDK. Supported networks and their SDKs can be found here.
- You must add additional configurations for each third party network.
- These entries are found by selecting your third party networks in the table.
Important
The DT FairBid SDK automatically detects and initializes SDKs from 3rd-party networks.
Once you've added all third party SDKs and set-up your app in the console, you can go ahead and initialize the DT Fairbid SDK.