iOS SDK Integration

Before You Start

We support iOS version 9+. In case you use Xcode version lower than 9.3, we suggest archiving with 'bitcode' disabled.

Overview

This Guideline introduces the integration of AdTiming’s SDK in iOS Apps.

AdTiming offers diversified and competent monetization services and supports a variety of Ad formats including Native Ad, Interstitial Ad, Banner Ad, and Incentive Video Ad. The AdTiming platform mediates AdTiming, AdMob, Facebook, UnityAds, Vungle, Tapjoy, AppLovin, AdColony,  Chartboost, TikTok, Mintegral, GDT and IronSource.

 

Step 1. Add the SDK to Your Project

Importants!Since iOS SDK Version 4.0.0 and Above, the adapter for each ad network is modularized, which means that you need to download and add Not Only the SDK of mediation networks  you choose to work with But Also the adapters for those ad networks. For example, if you want to integrate AdMob and Applovin through AdTiming Mediation, you need to add the AdMob Adapter, AdMob SDK and Applovin Adapter, AppLovin SDK to the libs of your project. See the Add Mediation Networks for more infomation.

AdTiming supports both CocoaPods and manual download for SDK integration:

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 'AdTimingSDK','4.4.1'

 

Manual Download SDK Latest release

Download iOS SDK Version 4.4.1

 

AdTiming Mediation Demo App

The Integration Demo application demonstrate how to integrate the AdTiming Mediation in your app.

Download iOS Demo Application

 

Step 2. Build Settings

1. Add Linker Flags

  • Add the following linker flag to the build settings at:
    Target ➣ Build Settings ➣ Linking ➣ Other Linker Flags:
-ObjC

2. App Transport Security Settings

  • Add in a Dictionary called 'App Transport Security Settings'. Make sure you add this dictionary on the 'Top Level Key'.

  • Inside this dictionary, add a Boolean called 'Allow Arbitrary Loads' and send it to YES.

    111111.png

3. SKAdNetworkItems(For iOS 14)

  • Add in a Array called 'SKAdNetworkItems'. Make sure you add this dictionary on the 'Top Level Key'.

  • Add a Dictionary to the Array , add a String called 'SKAdNetworkIdentifier' and set value to '488r3q3dtq.skadnetwork'.

    SKAdNetwork.png

4. App Tracking Transparency(For iOS 14)

  • To display the App Tracking Transparency authorization request for accessing the IDFA, update your Info.plist to add the NSUserTrackingUsageDescription key with a custom message describing your usage.

    attinfo.png

  • To present the authorization request, call requestTrackingAuthorizationWithCompletionHandler:. We recommend waiting for the completion callback prior to loading ads, so that if the user grants the App Tracking Transparency permission, the AdTiming SDK can use the IDFA in ad requests.

#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>
- (void)requestUserIDFA { [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { // Tracking authorization completed. Start loading ads here.
// [self loadAd];
}];
import AppTrackingTransparency
import AdSupport
func resquestUserIDFA() { ATTrackingManager.requestTrackingAuthorization(completionHandler: {status in // Tracking authorization completed. Start loading ads here.
// loadAd()
})
}

 

Step 3. Initialize the AdTiming SDK

#import <ADTimingSDK/ADTimingSDK.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    [AdTiming initWithAppKey:@"YOUR_ADTIMING_APP_KEY"];
}
import AdTimingSDK
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:[UIApplication.LaunchOptionsKey: Any]?) -> Bool {    
  AdTiming.initWithAppKey("YOUR_ADTIMING_APP_KEY")
}

 

 

Send attribution data to AdTiming (optional)

If your project also integrates the AppsFlyer SDK, we need you to pass the application attribution data to AdTiming so that we can help you accurately calculate each Media Source, Campaign level ROAS, and LTV data.

1. When you receive the onConversionDataSuccess callback you can use the sendAFConversionData method for passing the attribution data dictionary:

For apps using AppsFlyer SDK version 5 and above 

- (void)onConversionDataSuccess:(NSDictionary *)conversionInfo {    
  /// Send AppsFlyer conversion data    
  [AdTiming sendAFConversionData:conversionInfo];
}
func onConversionDataSuccess(_conversionInfo: NSDictionary) {    
   /// Send AppsFlyer conversion data    
   AdTiming.sendAdConversionData(conversionInfo)
}

 

For apps using AppsFlyer SDK version 4 and below

- (void)onConversionDataReceived:(NSDictionary *)installData {    
  /// Send AppsFlyer conversion data    
  [AdTiming sendAFConversionData:installData];
}
func onConversionDataSuccess(_installData: NSDictionary) {    
   /// Send AppsFlyer conversion data    
   AdTiming.sendAFConversionData(installData)
}

 

2. When you receive the onAppOpenAttribution callback you can use the sendAFDeepLinkData method for passing the attribution data dictionary:

- (void)onAppOpenAttribution:(NSDictionary *)attributionData {    
  /// Send AppFlyer deep link attribution data    
  [AdTiming sendAFDeepLinkData:attributionData];
}
func onConversionDataSuccess(_attributionDate: NSDictionary) {    
   /// Send AppsFlyer conversion data    
   AdTiming.sendAFDeepLinkData(attributionData)
}

 

What’s Next?

1. Integrate our Rewarded Video, Interstitial, Banner and Native Ads in your app.
2. Follow 
our Add Mediation Networks and Mediation Network Guides to mediation networks.

Was this article helpful?
2 out of 2 found this helpful

Comments

0 comments

Article is closed for comments.