HomeiOS Developmentswift - How do I set off the onInitialized occasion listener within...

swift – How do I set off the onInitialized occasion listener within the Appylar iOS SDK?


I’ve carried out the Appylar iOS SDK, however I can not seem to get the occasion listeners triggered. I’ve referred to as the initialize perform and the SDK is initialized appropriately, however the occasion listener onInitialized isn’t triggered. Additionally, once I present banners, the occasion listener onBannerShown isn’t triggered both.

After I name the initialize perform, I count on the occasion listener onInitialized to be triggered:

// Initialize the SDK
AppylarManager.initialize(
    appKey: "my_app_key",
    adTypes: [AdType.banner],
    testMode: true
)

// That is by no means referred to as
func onInitialized() {
    print("initialized")
}

EDIT: I discovered the answer; for the occasion listeners to be triggered, they have to be explicitly set earlier than initializing the sdk:

override func viewDidLoad() {

    tremendous.viewDidLoad()

    AppylarManager.setEventListener(
        delegate: self, 
        bannerDelegate: self, 
        interstitialDelegate: self
    )

    AppylarManager.initialize(
        appKey: "my_app_key",
        adTypes: [AdType.banner, AdType.interstitial],
        testMode: true
    )
}

extension ViewController: AppylarDelegate {

    func onInitialized() {
        print("initialized")
    }

    func onError(error: String) {
        print("error: (error)")
    }
}

extension ViewController: BannerViewDelegate {

    func onNoBanner() {
        print("no banner")
    }

    func onBannerShown() {
        print("banner proven")
    }
}

extension ViewController: InterstitialDelegate {

    func onNoInterstitial() {
        print("no interstitial")
    }

    func onInterstitialShown() {
        print("interstitial proven")
    }

    func onInterstitialClosed() {
        print("interstitial closed")
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments