YMAInterstitialAd

Objective-C

@interface YMAInterstitialAd : NSObject

Swift

class YMAInterstitialAd : NSObject

This class is responsible for loading an interstitial ad.

  1. Properties
  2. adUnitID
  3. loaded
  4. delegate
  5. shouldOpenLinksInApp
  6. hasBeenPresented
  7. Methods
  8. -initWithAdUnitID:
  9. -load
  10. -loadWithRequest:
  11. -presentFromViewController:
  12. -presentFromViewController:dismissalBlock:

Properties

adUnitID

AdUnit ID is a unique identifier that is issued in the Partner interface and has the format R-M-XXXXXX-Y.

Declaration

Objective-C

@property (nonatomic, copy, readonly) NSString *_Nonnull adUnitID;

Swift

var adUnitID: String { get }

loaded

Notifies that the ad is loaded and ready to be displayed. After the property takes the YES value, the -[YMAInterstitialAdDelegate interstitialAdDidLoadAd:] delegate method is called.

Declaration

Objective-C

@property (nonatomic, readonly) BOOL loaded;

Swift

var loaded: Bool { get }

delegate

An object that implements the YMAInterstitialAdDelegate protocol that tracks ad lifecycle events.

Declaration

Objective-C

@property (nonatomic, weak, nullable) id<YMAInterstitialAdDelegate> delegate;

Swift

weak var delegate: YMAInterstitialAdDelegate? { get set }

shouldOpenLinksInApp

Defines whether to open links in the app or in the browser installed on the device. The default value is NO.

Declaration

Objective-C

@property (nonatomic) BOOL shouldOpenLinksInApp;

Swift

var shouldOpenLinksInApp: Bool { get set }

hasBeenPresented

Notifies whether the ad was displayed.

Declaration

Objective-C

@property (nonatomic, readonly) BOOL hasBeenPresented;

Swift

var hasBeenPresented: Bool { get }

Methods

-initWithAdUnitID:

Initializes an object of the YMAInterstitialAd class with an interstitial ad.

Declaration

Objective-C

- (nonnull instancetype)initWithAdUnitID:(nonnull NSString *)adUnitID;

Swift

init(adUnitID: String)

Parameters

adUnitID

AdUnit ID is a unique identifier that is issued in the Partner interface and has the format R-M-XXXXXX-Y.

adUnitID

AdUnit ID is a unique identifier that is issued in the Partner interface and has the format R-M-XXXXXX-Y.

Return Value

An object of the YMAInterstitialAd class with an interstitial ad.

-load

Preloads an ad. After this, use the -[YMAInterstitialAd presentFromViewController:] method to start showing the ad.

Declaration

Objective-C

- (void)load;

Swift

func load()

-loadWithRequest:

Preloads the ad by setting the data for targeting.

Declaration

Objective-C

- (void)loadWithRequest:(nullable YMAAdRequest *)request;

Swift

func load(with request: YMAAdRequest?)

Parameters

request

Data for targeting (YMAAdRequest).

request

Data for targeting (YMAAdRequest).

-presentFromViewController:

Use this method to display an interstitial ad after preloading.

Declaration

Objective-C

- (void)presentFromViewController:(nonnull UIViewController *)viewController;

Swift

func present(from viewController: UIViewController)

Parameters

viewController

An object of the UIViewController class, which is used to display an interstitial ad.

viewController

An object of the UIViewController class, which is used to display an interstitial ad.

-presentFromViewController:dismissalBlock:

Use this method to display an interstitial ad after preloading if you need the app to perform some action immediately after showing the ad.

Declaration

Objective-C

- (void)presentFromViewController:(nonnull UIViewController *)viewController
                   dismissalBlock:(nullable void (^)(void))dismissalBlock;

Swift

func present(from viewController: UIViewController, dismissalBlock: (() -> Void)? = nil)

Parameters

viewController

An object of the UIViewController class.

dismissalBlock

A block of code that executes after the ad is shown.

viewController

An object of the UIViewController class.

dismissalBlock

A block of code that executes after the ad is shown.