Wiki
AATKit iOS / Proposal / AATKit initialization2
Using the AddApptr SDK in your iOS project
AATKit Initialisation
AATKit initialization
Configuring AATKit
Before loading ads, call the initializeWithConfiguration: method on AATKit, which initializes the SDK. This only needs to be done once, ideally at app launch. You should call initializeWithConfiguration: as early as possible.
initializeWithConfiguration: is called with AATConfiguration object which contains the necessary configuration needed to initialize AATKit
Example usage:
Objective-C:
AATConfiguration* configuration = [[AATConfiguration alloc] init]; configuration.delegate = self; [AATKit initializeWithConfiguration:configuration];
let configuration = AATConfiguration() configuration.delegate = self AATKit.initialize(with: configuration)
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.
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.
Objective-C:
configuration.testModeAccountID = <<your account ID>>;
configuration.testModeAccountID = <<your account ID>>
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 AATKit.debug(true)
Setting 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 configuration.defaultViewController = <<your Current ViewController>>;
#!swift configuration.defaultViewController = <<your Current ViewController>>
You should set the view controller every time you change to another view controller, on which you want to display ads:
Objective-C:
[AATKit setViewController:self];
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.
Updated