Wiki

Clone wiki

AATKit iOS / AATKit2 / AATKit Initialisation

Using the AddApptr SDK in your iOS project

  1. Project Setup
  2. AATKit Initialisation
  3. Banner Integration
  4. Fullscreen Integration
  5. APP Open Integration
  6. Native Ads Integration
  7. Native Ads Integration - special ad network characteristics
  8. Promo Screen
  9. Sample
  10. Disable App Transport Security (ATS)
  11. Advanced Features
  12. Targeting
  13. Frequency Capping
  14. Header documentation
  15. Important Remarks
  16. AATKit's Size within your app
  17. What is an AdSpace?
  18. Network-specific Information
  19. Statistics Delegate
  20. Reports Delegate
  21. Listen to impression level information
  22. AATKit AdMob custom events adapter (>= 2.77.x)

AATKit Changelogs


Initialisation (Code Sample)

Initialise the AATKit by calling the class method:

#!objective-c
+ (void)initializeWithConfiguration:(nullable AATConfiguration*)configuration

configuration: Allows for providing configuration parameter to the AATKit.

Initialising the AATKit has to be done before any Ad can be displayed.
 During this process, the AATKit contacts the AddApptr servers for Ad network configurations, which are necessary for authenticating towards the various Ad networks.


Note: Since AATKit 2.66.10 you are able to reconfigure AATKit. To do so, you can use the class method:

#!objective-c
+ (void)reconfigureUsingConfiguration:(nonnull AATRuntimeConfiguration*)configuration
        NS_SWIFT_NAME(reconfigure(using:));

configuration: Contains new runtime information. Only properties in AATRuntimeConfiguration are considered.

Use your TestID to test your application

Use the accountID for receiving example Ads. The accountID can be set in your AATConfiguration object. The accountID will be sent to you after registering at www.AddApptr.com.

#!objective-c
@property (nullable) NSNumber* testModeAccountID;

Example usage:

Objective-C

    AATConfiguration* aatConf   = [[AATConfiguration alloc] init];
    aatConf.testModeAccountID   = <<your account ID>>;
    
    [AATKit initializeWithConfiguration:aatConf];
Swift
    let aatConf = AATConfiguration()
    aatConf.testModeAccountID = <<your account ID>>
    
    AATKit.initialize(with: aatConf)

The AddApptr SDK identifies your app using the bundleID from the Apple app store. For the identification to work properly, it is important to disable the test-mode before going public with your app. Simply do not set the testModeAccountID property.

Remember to disable test mode before you submit to the app-store! Disabling is done by omitting the testID.

Activate the debug mode

To see debug output in the Xcode console, you can use the following method before initializing AATKit:

#!objective-c
+ (void)debug:(bool)flag; //default is set to NO

Example usage:

Objective-C:

#!objective-c
[AATKit debug:YES];
Swift:
#!swift
AATKit.debug(true)

Set the view controller

You can set the view controller for your ad requests on the AATConfiguration object when initializing the AATKit:

Objective-C:

#!objective-c
AATConfiguration* aatConfiguration = [[AATConfiguration alloc] init];
aatConfiguration.defaultViewController = self;
[AATKit initializeWithConfiguration:aatConfiguration];
Swift:
#!swift
let aatConfiguration = AATConfiguration()
aatConfiguration.defaultViewController = self
AATKit.initialize(with: aatConfiguration)

You should set the view controller every time you change to another view controller, on which you want to display ads:

Objective-C:

#!objective-c
[AATKit setViewController:self];
Swift:
#!swift
AATKit.setViewController(self)

There are also special APIs for setting the view controller, e.g. for native ads. Please take a look at these chapters to learn more about that.

Important: For some ad networks, like the Google ad networks, you always have to set the view controller when performing an ad request, because they will ignore any ad request that doesn't hand over a view controller.

Listening to the reports requests

You can listen to all reports API requests by conforming to protocol AATReportsDelegate and pass that class (which conforms to the protocol) to AATConfiguration while initialising AATKit

Swift:

#!swift
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:
        [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        let configuration = AATConfiguration()
        configuration.reportsDelegate = self
        ...
        AATKit.initialize(with: configuration)
    }
}
extension AppDelegate: AATReportsDelegate {
    func onReportSent(_ report: String) {
        print("onReportSent \(report)")
    }
}

For how to add handle consent in your project please refer to Consent Handling Guide

back (Project Setup)

next (Banner Integration)

Updated