GADInterstitialAd
@interface GADInterstitialAd : NSObject <GADFullScreenPresentingAd>
An interstitial ad. This is a full-screen advertisement shown at natural transition points in your application such as between game levels or news stories. See https://developers.google.com/admob/ios/interstitial to get started.
-
The ad unit ID.
Declaration
Swift
var adUnitID: String { get }
Objective-C
@property (nonatomic, readonly, nonnull) NSString *adUnitID;
-
Information about the ad response that returned the ad.
Declaration
Swift
var responseInfo: GADResponseInfo { get }
Objective-C
@property (nonatomic, readonly, nonnull) GADResponseInfo *responseInfo;
-
Delegate for handling full screen content messages.
Declaration
Swift
weak var fullScreenContentDelegate: (any GADFullScreenContentDelegate)? { get set }
Objective-C
@property (nonatomic, weak, nullable) id<GADFullScreenContentDelegate> fullScreenContentDelegate;
-
Called when the ad is estimated to have earned money. Available for allowlisted accounts only.
Declaration
Swift
var paidEventHandler: GADPaidEventHandler? { get set }
Objective-C
@property (nonatomic, copy, nullable) GADPaidEventHandler paidEventHandler;
-
Loads an interstitial ad.
Declaration
Swift
class func load(withAdUnitID adUnitID: String, request: GADRequest?) async throws -> GADInterstitialAd
Objective-C
+ (void)loadWithAdUnitID:(nonnull NSString *)adUnitID request:(nullable GADRequest *)request completionHandler: (nonnull GADInterstitialAdLoadCompletionHandler)completionHandler;
Parameters
adUnitID
An ad unit ID created in the AdMob or Ad Manager UI.
request
An ad request object. If nil, a default ad request object is used.
completionHandler
A handler to execute when the load operation finishes or times out.
-
Loads an interstitial ad.
Declaration
Swift
class func load(withAdResponseString adResponseString: String) async throws -> GADInterstitialAd
Objective-C
+ (void)loadWithAdResponseString:(nonnull NSString *)adResponseString completionHandler: (nonnull GADInterstitialAdLoadCompletionHandler) completionHandler;
Parameters
adResponseString
A server-to-server ad response string.
completionHandler
A handler to execute when the load operation finishes or times out.
-
Indicates whether the interstitial ad can be presented from the provided root view controller. Must be called on the main thread.
Declaration
Swift
func canPresent(fromRootViewController rootViewController: UIViewController?) throws
Objective-C
- (BOOL)canPresentFromRootViewController: (nullable UIViewController *)rootViewController error:(NSError *_Nullable *_Nullable)error;
Return Value
YES
if the interstitial ad can be presented from the provided root view controller,NO
otherwise. -
Presents the interstitial ad. Must be called on the main thread.
Declaration
Swift
func present(fromRootViewController rootViewController: UIViewController?)
Objective-C
- (void)presentFromRootViewController: (nullable UIViewController *)rootViewController;
Parameters
rootViewController
A view controller to present the ad. If nil, attempts to present from the top view controller of the application’s main window.