Skip to content

Event Handlers

If you want to handle ADvantage events, you need to implement the delegation methods. Extending our AdvantageDelegate class.

advantage:didFailWithError

This method will be called in any error case such as, no internet connection, connection/timeout, license issues and etc. The String msg will contain the error message which you can log into the logcat to trace the problem!

func advantage(_ advantage: ADvantage, didFailWithError error: String?) {...}
- (void)advantage:(ADvantage *)advantage didFailWithError:(NSString *)error {...}

advantageDidClose

This method will be called when an ad is completely closed!

func advantageDidClose(_ advantage: ADvantage) {...}
- (void)advantageDidClose:(ADvantage *)advantage {...}

advantage:didLoad

This method will be called when the ad request was completed. This callback contains an status which is an enumerator and could have the following values:

  • AVLoadedWithAd - Ad loaded successfully.
  • AVLoadedWithoutAd - There is no campaign available at the moment.
func advantage(_ advantage: ADvantage, didLoad state: AVLoadedState)
- (void)advantage:(ADvantage advantage didLoad:(AVLoadedState)state {...}

advantage:didExpandTo

This method will be called when an modal view is created (it will be triggered by the advertisement)

func advantage(_ advantage: ADvantage, didExpandTo rect: CGRect) {...}
- (void)advantage:(ADvantage *)advantage didExpandTo:(CGRect)rect {...}

advantage:didResizeTo

This method will be called when the ad space changes its size e.g. height change (it will be triggered by the advertisement)

func advantage(_ advantage: ADvantage, didResizeTo rect: CGRect) {...}
- (void)advantage:(ADvantage *)advantage didResizeTo:(CGRect)rect {...}

advantage:didUpdateBannerHeightTo

This method will be called when the ad space changes its position and/or size change (it will be triggered by the advertisement)

func advantage(_ advantage: ADvantage, didUpdateBannerHeightTo height: CGFloat) {...}
- (void)advantage:(nonnull ADvantage *)advantage didUpdateBannerHeightTo:(CGFloat)height {...}

advantage:didUpdateLayoutTo (deprecated)

This method will be called when the ad space changes its position and/or size change (it will be triggered by the advertisement)

func advantage(_ advantage: ADvantage, didUpdateLayoutTo rect: CGRect) {...}
- (void)advantage:(nonnull ADvantage *)advantage didUpdateLayoutTo:(CGRect)rect {...}

advantage: notifyWithMessage / notifyWithDictionary

These methods are reserved for custom external plugins and future use cases.

func advantage(_ advantage: ADvantage, notifyWithMessage message: String?) {...}
func advantage(_ advantage: ADvantage, notifyWith dic: [AnyHashable : Any]) {...}
- (void)advantage:(ADvantage *)advantage notifyWithMessage:(NSString *)message {...}
- (void)advantage:(ADvantage *)advantage notifyWithDictionary:(NSDictionary *)dic {...}