YMANativeAdDelegate

Objective-C

@protocol YMANativeAdDelegate <NSObject>

Swift

protocol YMANativeAdDelegate : NSObjectProtocol

The protocol defines the methods of the delegate that monitors native ads.

  1. Methods
  2. -viewControllerForPresentingModalView
  3. -nativeAdDidClick:
  4. -nativeAdWillLeaveApplication:
  5. -nativeAd:willPresentScreen:
  6. -nativeAd:didDismissScreen:
  7. -nativeAd:didTrackImpressionWithData:
  8. -closeNativeAd:

Methods

-viewControllerForPresentingModalView

UIViewController object that is used for showing a modal controller in response to the user’s interaction with the banner.

Declaration

Objective-C

- (nullable UIViewController *)viewControllerForPresentingModalView;

Swift

optional func viewControllerForPresentingModalView() -> UIViewController?

Return Value

UIViewController object that is used for showing a modal controller in response to the user’s interaction with the banner.

-nativeAdDidClick:

Notifies that the user clicked on the ad.

Declaration

Objective-C

- (void)nativeAdDidClick:(nonnull id<YMANativeAd>)ad;

Parameters

ad

A reference to the object that invoked the method.

ad

A reference to the object that invoked the method.

-nativeAdWillLeaveApplication:

Notifies that the user switched from the ad to an app (for example, the browser).

Declaration

Objective-C

- (void)nativeAdWillLeaveApplication:(nonnull id<YMANativeAd>)ad;

Parameters

ad

A reference to the object that invoked the method.

ad

A reference to the object that invoked the method.

-nativeAd:willPresentScreen:

Notifies that the ad will show the modal UIViewController in response to the user interacting with the banner.

Declaration

Objective-C

- (void)nativeAd:(nonnull id<YMANativeAd>)ad
    willPresentScreen:(nullable UIViewController *)viewController;

Parameters

ad

A reference to the object that invoked the method.

viewController

Modal UIViewController.

ad

A reference to the object that invoked the method.

viewController

Modal UIViewController.

-nativeAd:didDismissScreen:

Notifies that the ad finished showing the modal UIViewController in response to the user interacting with the banner.

Declaration

Objective-C

- (void)nativeAd:(nonnull id<YMANativeAd>)ad
    didDismissScreen:(nullable UIViewController *)viewController;

Parameters

ad

A reference to the object that invoked the method.

viewController

Modal UIViewController.

ad

A reference to the object that invoked the method.

viewController

Modal UIViewController.

-nativeAd:didTrackImpressionWithData:

It’s called when an ad impression has been counted.

Declaration

Objective-C

- (void)nativeAd:(nonnull id<YMANativeAd>)ad
    didTrackImpressionWithData:(nullable id<YMAImpressionData>)impressionData;

Parameters

ad

A reference to the object of the YMANativeAd class that invoked the method.

impressionData

Revenue data at the level of ad impressions.

ad

A reference to the object of the YMANativeAd class that invoked the method.

impressionData

Revenue data at the level of ad impressions.

-closeNativeAd:

Notifies that the user has chosen a reason for closing the ad and the ad must be hidden.

Note

Ads won’t be hidden. The developer must determine what to do with the ad after the reason for closing it is chosen.

Declaration

Objective-C

- (void)closeNativeAd:(nonnull id<YMANativeAd>)ad;

Parameters

ad

A reference to the object that invoked the method.

ad

A reference to the object that invoked the method.