GADAdLoader

@interface GADAdLoader : NSObject

Loads ads. See GADAdLoaderAdTypes.h for available ad types.

  • Object notified when an ad request succeeds or fails. Must conform to requested ad types’ delegate protocols.

    Declaration

    Swift

    weak var delegate: GADAdLoaderDelegate? { get set }

    Objective-C

    @property (readwrite, nonatomic, nullable) id<GADAdLoaderDelegate> delegate;
  • The ad loader’s ad unit ID.

    Declaration

    Swift

    var adUnitID: String { get }

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull adUnitID;
  • Returns an initialized ad loader configured to load the specified ad types.

    Declaration

    Swift

    init(adUnitID: String, rootViewController: Any!, adTypes: [GADAdLoaderAdType], options: [GADAdLoaderOptions]?)

    Objective-C

    - (nonnull instancetype)
      initWithAdUnitID:(nonnull NSString *)adUnitID
    rootViewController:(id)rootViewController
               adTypes:(nonnull NSArray<GADAdLoaderAdType> *)adTypes
               options:(NSArray<GADAdLoaderOptions *> *_Nullable)options;

    Parameters

    rootViewController

    The root view controller is used to present ad click actions.

    adTypes

    An array of ad types. See GADAdLoaderAdTypes.h for available ad types.

    options

    An array of GADAdLoaderOptions objects to configure how ads are loaded, or nil to use default options. See each ad type’s header for available GADAdLoaderOptions subclasses.

  • Loads the ad and informs the delegate of the outcome.

    Declaration

    Swift

    func load(_ request: GADRequest?)

    Objective-C

    - (void)loadRequest:(GADRequest *_Nullable)request;