Wiki

Clone wiki

Banner Sample / AATKit 3 initialization migration

AATKit initialization

Index:

  1. Configuring AATKit
  2. Using TestID for testing
  3. Activate the debug mode
  4. Setting the view controller

AATKit initialization

Configuring AATKit

Before loading ads, call the initAATKit(with configuration: AATKitConfiguration?) method on AATSDK, which initializes the SDK. This only needs to be done once, ideally at app launch. You should call initAATKit(with configuration: AATConfiguration?) as early as possible.

initAATKit(with configuration: AATConfiguration?) is called with AATConfiguration object which contains the necessary configuration needed to initialize AATKit

Instead of:

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)
Use:

Objective-C:

AATConfiguration *configuration = [[AATConfiguration alloc] init];
configuration.delegate = self;
[AATSDK initAATKitWith:configuration];
Swift:
let configuration = AATConfiguration()
configuration.delegate = self
AATSDK.initAATKit(with: configuration)

for more information on AATDelegate please refer to AATDelegates Guide

Reconfigure AATKit.

If you need to reconfigure AATKit you can use the class method:

Swift:

static func reconfigure(configuration: AATRuntimeConfiguration)

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

Using TestID for testing

You can use your TestID to test your application. The accountID can be set in your AATConfiguration object. The accountID will be sent to you after registering at www.AddApptr.com.

Instead of:

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)

Use:

Objective-C:

AATConfiguration* configuration   = [[AATConfiguration alloc] init];
configuration.testModeAccountId   = <<your account ID>>;

[AATSDK initAATKitWith:configuration];
Swift:
let configuration = AATConfiguration()
configuration.testModeAccountId = <<your account ID>>

AATSDK.initAATKit(with: configuration)
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:

Swift:

static func setLogLevel(logLevel: AATLogLevel)

Instead of:

Objective-C:

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

Use:

Objective-C:

[AATSDK setLogLevelWithLogLevel:AATLogLevelDebug];
Swift:
AATSDK.setLogLevel(logLevel: .debug)

Setting the view controller

You can set the view controller for your current placements, you should set the viewController in your viewController viewDidApear method.

Instead of:

Objective-C:

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

Use:

Objective-C:

[AATSDK controllerViewDidAppearWithController: <<your Current ViewController>>];
Swift:
AATSDK.controllerViewDidAppear(controller: <<your Current ViewController>>)

Also in your viewController viewWillDisappear call the following method:

-Objective-C:

[AATSDK controllerViewWillDisappear];
Swift:
AATSDK.controllerViewWillDisappear()

AATKit 3 Consent handling migration (beta)

Updated