Configuration

Initialization

  1. Initialize the SDK. Call SDK initialization as soon as possible, preferably in application:didFinishLaunchingWithOptions: method:

AdPlayer.initSdk( storeURL: URL(string: ...)!) // app store url )

Calling any of the AdPlayer APIs before initialization will result in errors!

Before this method is called, the SDK will not perform any operations and will not use any resources (memory, cpu, network etc.).

  1. Initialize the player tags. It is best to be called right after initialization.
    If the tags belong to multiple publishers, this method must be called once per publisher.

var tagConfig = AdPlayerTagConfiguration(tagId: tagId) tagConfig.macros = [ // providing macroses is optional .init(key: "macro_key1", value: "macro_value1"), .init(key: "macro_key2", value: "macro_value2") ] let publisherConfig = AdPlayerPublisherConfiguration(publisherId: publisherId, tag: tagConfig) AdPlayer.initializePublisher(publisherConfig) { result in .... }


When there’s more than 1 tag:

let tagConfig1 = AdPlayerTagConfiguration(tagId: tagId1) let tagConfig2 = AdPlayerTagConfiguration(tagId: tagId2) guard let publisherConfig = try? AdPlayerPublisherConfiguration( publisherId: publisherId, tags: [tagConfig1, tagConfig2] // at least 1 tag is required ) else { // Invalid AdPlayerPublisherConfiguration return } AdPlayer.initializePublisher(publisherConfig) { ... }

All the player tags of this publisher that are expected to be presented in the application must be provided in the constructor of AdPlayerPublisherConfiguration.