GoogleMobileAds Framework Reference
Stay organized with collections Save and categorize content based on your preferences.
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 protocol. This property must be set before initiating ad requests.
Declaration
Swift
weak var delegate: (any AdLoaderDelegate)? { get set }
-
The ad loader’s ad unit ID.
Declaration
Swift
var adUnitID: String { get }
Objective-C
@property (nonatomic, readonly, nonnull) NSString *adUnitID;
-
Indicates whether the ad loader is loading.
Declaration
Swift
var isLoading: Bool { get }
Objective-C
@property (nonatomic, readonly, getter=isLoading) BOOL loading;
-
Returns an initialized ad loader configured to load the specified ad types.
Declaration
Swift
init(adUnitID: String, rootViewController: UIViewController?, adTypes: [AdLoaderAdType], options: [GADAdLoaderOptions]?)
Objective-C
- (nonnull instancetype) initWithAdUnitID:(nonnull NSString *)adUnitID rootViewController:(nullable UIViewController *)rootViewController adTypes:(nonnull NSArray<GADAdLoaderAdType> *)adTypes options:(nullable NSArray<GADAdLoaderOptions *> *)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: Request?)
Objective-C
- (void)loadRequest:(nullable GADRequest *)request;
-
Returns an initialized ad loader.
Declaration
Swift
init(rootViewController: UIViewController?)
Objective-C
- (nonnull instancetype)initWithRootViewController: (nullable UIViewController *)rootViewController;
Parameters
rootViewController | The root view controller used to present ad click actions. |
-
Loads the ad and informs the delegate of the outcome.
Declaration
Swift
func load(with adResponseString: String)
Objective-C
- (void)loadWithAdResponseString:(nonnull NSString *)adResponseString;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[[["\u003cp\u003eGADAdLoader is responsible for loading various ad types, specified using GADAdLoaderAdTypes.\u003c/p\u003e\n"],["\u003cp\u003eBefore loading ads, set the \u003ccode\u003edelegate\u003c/code\u003e property to receive success or failure notifications.\u003c/p\u003e\n"],["\u003cp\u003eInitialize GADAdLoader with the ad unit ID, root view controller, desired ad types, and optional loading options.\u003c/p\u003e\n"],["\u003cp\u003eInitiate ad loading by calling \u003ccode\u003eloadRequest:\u003c/code\u003e or \u003ccode\u003eload\u003c/code\u003e with a GADRequest object.\u003c/p\u003e\n"],["\u003cp\u003eFor server-to-server ads, use the dedicated initializer and \u003ccode\u003eloadWithAdResponseString:\u003c/code\u003e method.\u003c/p\u003e\n"]]],["The `GADAdLoader` class loads ads, with available types specified in `GADAdLoaderAdTypes.h`. Key actions include setting a delegate to receive ad success/failure notifications, using an `adUnitID`, and checking `isLoading` status. Initialization involves specifying `adUnitID`, `rootViewController`, `adTypes`, and optional configurations. Ads are loaded via `loadRequest:` or `load(with adResponseString:)`, informing the delegate of the result. `ServerToServer` offers initialization with a root view controller, and loading via an ad response string.\n"],null,["GADAdLoader \n\n\n @interface GADAdLoader : NSObject\n\nLoads ads. See GADAdLoaderAdTypes.h for available ad types.\n- `\n ``\n ``\n `\n\n [delegate](#/c:objc(cs)GADAdLoader(py)delegate)`\n ` \n Object notified when an ad request succeeds or fails. Must conform to requested ad types'\n delegate protocol. This property must be set before initiating ad requests. \n\n Declaration \n Swift \n\n weak var delegate: (any AdLoaderDelegate)? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) id\u003c../Protocols/GADAdLoaderDelegate.html\u003e delegate;\n\n- `\n ``\n ``\n `\n\n [adUnitID](#/c:objc(cs)GADAdLoader(py)adUnitID)`\n ` \n The ad loader's ad unit ID. \n\n Declaration \n Swift \n\n var adUnitID: String { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nonnull) NSString *adUnitID;\n\n- `\n ``\n ``\n `\n\n [loading](#/c:objc(cs)GADAdLoader(py)loading)`\n ` \n Indicates whether the ad loader is loading. \n\n Declaration \n Swift \n\n var isLoading: Bool { get }\n\n Objective-C \n\n @property (nonatomic, readonly, getter=isLoading) BOOL loading;\n\n- `\n ``\n ``\n `\n\n [-initWithAdUnitID:rootViewController:adTypes:options:](#/c:objc(cs)GADAdLoader(im)initWithAdUnitID:rootViewController:adTypes:options:)`\n ` \n Returns an initialized ad loader configured to load the specified ad types. \n\n Declaration \n Swift \n\n init(adUnitID: String, rootViewController: UIViewController?, adTypes: [AdLoaderAdType], options: [../Classes.html#/c:objc(cs)GADAdLoaderOptions]?)\n\n Objective-C \n\n - (nonnull instancetype)\n initWithAdUnitID:(nonnull NSString *)adUnitID\n rootViewController:(nullable UIViewController *)rootViewController\n adTypes:(nonnull NSArray\u003c../Type-Definitions.html#/c:GADAdLoaderAdTypes.h@T@GADAdLoaderAdType\u003e *)adTypes\n options:(nullable NSArray\u003c../Classes.html#/c:objc(cs)GADAdLoaderOptions *\u003e *)options;\n\n Parameters\n\n |----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*rootViewController*` ` | The root view controller is used to present ad click actions. |\n | ` `*adTypes*` ` | An array of ad types. See GADAdLoaderAdTypes.h for available ad types. |\n | ` `*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. |\n\n- `\n ``\n ``\n `\n\n [-loadRequest:](#/c:objc(cs)GADAdLoader(im)loadRequest:)`\n ` \n Loads the ad and informs the delegate of the outcome. \n\n Declaration \n Swift \n\n func load(_ request: Request?)\n\n Objective-C \n\n - (void)loadRequest:(nullable ../Classes/GADRequest.html *)request;\n\n[ServerToServer](#/ServerToServer)\n\n- `\n ``\n ``\n `\n\n [-initWithRootViewController:](#/c:objc(cs)GADAdLoader(im)initWithRootViewController:)`\n ` \n Returns an initialized ad loader. \n\n Declaration \n Swift \n\n init(rootViewController: UIViewController?)\n\n Objective-C \n\n - (nonnull instancetype)initWithRootViewController:\n (nullable UIViewController *)rootViewController;\n\n Parameters\n\n |----------------------------|------------------------------------------------------------|\n | ` `*rootViewController*` ` | The root view controller used to present ad click actions. |\n\n- `\n ``\n ``\n `\n\n [-loadWithAdResponseString:](#/c:objc(cs)GADAdLoader(im)loadWithAdResponseString:)`\n ` \n Loads the ad and informs the delegate of the outcome. \n\n Declaration \n Swift \n\n func load(with adResponseString: String)\n\n Objective-C \n\n - (void)loadWithAdResponseString:(nonnull NSString *)adResponseString;"]]