commit | author | age
|
96fe76
|
1 |
// |
L |
2 |
// GADInterstitialAd.h |
|
3 |
// Google Mobile Ads SDK |
|
4 |
// |
|
5 |
// Copyright 2020 Google LLC. All rights reserved. |
|
6 |
// |
|
7 |
|
|
8 |
#import <Foundation/Foundation.h> |
|
9 |
#import <UIKit/UIKit.h> |
|
10 |
|
|
11 |
#import <GoogleMobileAds/GADAdValue.h> |
|
12 |
#import <GoogleMobileAds/GADFullScreenContentDelegate.h> |
|
13 |
#import <GoogleMobileAds/GADRequest.h> |
|
14 |
#import <GoogleMobileAds/GADResponseInfo.h> |
|
15 |
#import <GoogleMobileAds/GADServerSideVerificationOptions.h> |
|
16 |
|
|
17 |
@class GADInterstitialAd; |
|
18 |
|
|
19 |
/// A block to be executed when the ad request operation completes. On success, |
|
20 |
/// interstitialAd is non-nil and |error| is nil. On failure, interstitialAd is nil |
|
21 |
/// and |error| is non-nil. |
|
22 |
typedef void (^GADInterstitialAdLoadCompletionHandler)(GADInterstitialAd *_Nullable interstitialAd, |
|
23 |
NSError *_Nullable error); |
|
24 |
|
|
25 |
/// An interstitial ad. This is a full-screen advertisement shown at natural transition points in |
|
26 |
/// your application such as between game levels or news stories. See |
|
27 |
/// https://developers.google.com/admob/ios/interstitial to get started. |
|
28 |
@interface GADInterstitialAd : NSObject <GADFullScreenPresentingAd> |
|
29 |
|
|
30 |
/// The ad unit ID. |
|
31 |
@property(nonatomic, readonly, nonnull) NSString *adUnitID; |
|
32 |
|
|
33 |
/// Information about the ad response that returned the ad. |
|
34 |
@property(nonatomic, readonly, nonnull) GADResponseInfo *responseInfo; |
|
35 |
|
|
36 |
/// Delegate for handling full screen content messages. |
|
37 |
@property(nonatomic, weak, nullable) id<GADFullScreenContentDelegate> fullScreenContentDelegate; |
|
38 |
|
|
39 |
/// Called when the ad is estimated to have earned money. Available for allowlisted accounts only. |
|
40 |
@property(nonatomic, nullable, copy) GADPaidEventHandler paidEventHandler; |
|
41 |
|
|
42 |
/// Loads an interstitial ad. |
|
43 |
/// |
|
44 |
/// @param adUnitID An ad unit ID created in the AdMob or Ad Manager UI. |
|
45 |
/// @param request An ad request object. If nil, a default ad request object is used. |
|
46 |
/// @param completionHandler A handler to execute when the load operation finishes or times out. |
|
47 |
+ (void)loadWithAdUnitID:(nonnull NSString *)adUnitID |
|
48 |
request:(nullable GADRequest *)request |
|
49 |
completionHandler:(nonnull GADInterstitialAdLoadCompletionHandler)completionHandler; |
|
50 |
|
|
51 |
/// Returns whether the interstitial ad can be presented from the provided root view |
|
52 |
/// controller. Sets the error out parameter if the ad can't be presented. Must be called on the |
|
53 |
/// main thread. If rootViewController is nil, uses the top view controller of the application's |
|
54 |
/// main window. |
|
55 |
- (BOOL)canPresentFromRootViewController:(nullable UIViewController *)rootViewController |
|
56 |
error:(NSError *_Nullable __autoreleasing *_Nullable)error; |
|
57 |
|
|
58 |
/// Presents the interstitial ad. Must be called on the main thread. |
|
59 |
/// |
|
60 |
/// @param rootViewController A view controller to present the ad. If nil, attempts to present from |
|
61 |
/// the top view controller of the application's main window. |
|
62 |
- (void)presentFromRootViewController:(nullable UIViewController *)rootViewController; |
|
63 |
|
|
64 |
@end |