GADInterstitial.h 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // GADInterstitial.h
  3. // Google Mobile Ads SDK
  4. //
  5. // Copyright 2011 Google Inc. All rights reserved.
  6. //
  7. #import <UIKit/UIKit.h>
  8. #import "GADInAppPurchaseDelegate.h"
  9. #import "GADInterstitialDelegate.h"
  10. #import "GADRequest.h"
  11. #import "GADRequestError.h"
  12. #import "GoogleMobileAdsDefines.h"
  13. /// An interstitial ad. This is a full-screen advertisement shown at natural transition points in
  14. /// your application such as between game levels or news stories.
  15. @interface GADInterstitial : NSObject
  16. /// Initializes an interstitial with an ad unit created on the AdMob website. Create a new ad unit
  17. /// for every unique placement of an ad in your application. Set this to the ID assigned for this
  18. /// placement. Ad units are important for targeting and statistics.
  19. ///
  20. /// Example AdMob ad unit ID: @"ca-app-pub-0123456789012345/0123456789"
  21. - (instancetype)initWithAdUnitID:(NSString *)adUnitID NS_DESIGNATED_INITIALIZER;
  22. #pragma mark Pre-Request
  23. /// Required value passed in with initWithAdUnitID:.
  24. @property(nonatomic, readonly, copy) NSString *adUnitID;
  25. /// Optional delegate object that receives state change notifications from this GADInterstitalAd.
  26. /// Remember to nil this property before deallocating the delegate.
  27. @property(nonatomic, weak) id<GADInterstitialDelegate> delegate;
  28. /// Optional delegate object that receives in-app purchase notifications from this ad. Required for
  29. /// the custom in-app purchase flow, but ignored when using the default in-app purchase flow.
  30. /// Remember to nil this property before deallocating the delegate.
  31. @property(nonatomic, weak) id<GADInAppPurchaseDelegate> inAppPurchaseDelegate;
  32. #pragma mark Making an Ad Request
  33. /// Makes an interstitial ad request. Additional targeting options can be supplied with a request
  34. /// object. Only one interstitial request is allowed at a time.
  35. ///
  36. /// This is best to do several seconds before the interstitial is needed to preload its content.
  37. /// Then when transitioning between view controllers show the interstital with
  38. /// presentFromViewController.
  39. - (void)loadRequest:(GADRequest *)request;
  40. #pragma mark Post-Request
  41. /// Returns YES if the interstitial is ready to be displayed. The delegate's
  42. /// interstitialAdDidReceiveAd: will be called after this property switches from NO to YES.
  43. @property(nonatomic, readonly, assign) BOOL isReady;
  44. /// Returns YES if this object has already been presented. Interstitial objects can only be used
  45. /// once even with different requests.
  46. @property(nonatomic, readonly, assign) BOOL hasBeenUsed;
  47. /// Returns the ad network class name that fetched the current ad. Returns nil while the latest ad
  48. /// request is in progress or if the latest ad request failed. For both standard and mediated Google
  49. /// AdMob ads, this method returns @"GADMAdapterGoogleAdMobAds". For ads fetched via mediation
  50. /// custom events, this method returns @"GADMAdapterCustomEvents".
  51. @property(nonatomic, readonly, copy) NSString *adNetworkClassName;
  52. /// Presents the interstitial ad which takes over the entire screen until the user dismisses it.
  53. /// This has no effect unless isReady returns YES and/or the delegate's interstitialDidReceiveAd:
  54. /// has been received.
  55. ///
  56. /// Set rootViewController to the current view controller at the time this method is called. If your
  57. /// application does not use view controllers pass in nil and your views will be removed from the
  58. /// window to show the interstitial and restored when done. After the interstitial has been removed,
  59. /// the delegate's interstitialDidDismissScreen: will be called.
  60. - (void)presentFromRootViewController:(UIViewController *)rootViewController;
  61. #pragma mark Deprecated
  62. /// Deprecated intializer. Use initWithAdUnitID: instead.
  63. - (instancetype)init GAD_DEPRECATED_MSG_ATTRIBUTE("Use initWithAdUnitID:.");
  64. /// Deprecated setter, use initWithAdUnitID: instead.
  65. - (void)setAdUnitID:(NSString *)adUnitID
  66. GAD_DEPRECATED_MSG_ATTRIBUTE("Use initWithAdUnitID: instead of setting the ad unit ID.");
  67. @end