YMAInterstitialAd
Objective-C
@interface YMAInterstitialAd : NSObject
Swift
class YMAInterstitialAd : NSObject
This class is responsible for loading an interstitial ad.
- Properties
- adUnitID
- loaded
- delegate
- shouldOpenLinksInApp
- hasBeenPresented
- Methods
- -initWithAdUnitID:
- -load
- -loadWithRequest:
- -presentFromViewController:
- -presentFromViewController:dismissalBlock:
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 }
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 }
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 }
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 }
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.
Preloads an ad. After this, use the -[YMAInterstitialAd presentFromViewController:]
method to start showing the ad.
Declaration
Objective-C
- (void)load;
Swift
func load()
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 ( |
request | Data for targeting ( |
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 |
viewController | An object of the |
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 |
dismissalBlock | A block of code that executes after the ad is shown. |
viewController | An object of the |
dismissalBlock | A block of code that executes after the ad is shown. |