Wiki
Clone wikiAATKit iOS / Proposal / AATKit 3 initialization migration
AATKit initialization
AATKit initialization
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];
let aatConf = AATConfiguration() aatConf.testModeAccountID = <<your account ID>> … AATKit.initialize(with: aatConf)
Objective-C:
AATConfiguration *configuration = [[AATConfiguration alloc] init]; configuration.delegate = self; [AATSDK initAATKitWith:configuration];
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];
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];
let configuration = AATConfiguration() configuration.testModeAccountId = <<your account ID>> … AATSDK.initAATKit(with: configuration)
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 AATKit.debug(true)
Use:
Objective-C:
[AATSDK setLogLevelWithLogLevel:AATLogLevelDebug];
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 AATKit.setViewController(self)
Use:
Objective-C:
[AATSDK controllerViewDidAppearWithController: <<your Current ViewController>>];
AATSDK.controllerViewDidAppear(controller: <<your Current ViewController>>)
Also in your viewController viewWillDisappear
call the following method:
-Objective-C:
[AATSDK controllerViewWillDisappear];
AATSDK.controllerViewWillDisappear()
AATKit 3 Consent handling migration (beta)
Updated