GoogleInteractiveMediaAds Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
IMAAdsLoader
@interface IMAAdsLoader : NSObject
The IMAAdsLoader class allows the requesting of ads from the ad server.
Use the delegate to receive the loaded ads or loading error
in case of failure.
-
SDK-wide settings. Note that certain settings will only be evaluated during initialization of
the adsLoader.
Declaration
Objective-C
@property (nonatomic, copy, readonly) IMASettings *_Nonnull settings;
-
Delegate that receives IMAAdsLoaderDelegate callbacks.
-
Declaration
Swift
class func sdkVersion() -> String
Objective-C
+ (nonnull NSString *)sdkVersion;
Return Value
the SDK version
-
Initializes an IMAAdsLoader with specific settings. The loader takes 1-2 seconds to setup once
initialized, therefore reusing a single instance of the ads loader is encouraged to minimize ad
request times.
Declaration
Objective-C
- (nonnull instancetype)initWithSettings:(nullable IMASettings *)settings;
Parameters
settings
|
the IMASettings to use for SDK wide settings. Uses defaults when nil.
|
Return Value
an IMAAdsLoader instance with given IMASettings
-
Initializes the IMAAdsLoader with default settings. The loader takes 1-2 seconds to setup once
initialized, therefore reusing a single instance of the ads loader is encouraged to minimize ad
request times.
Declaration
Objective-C
- (nonnull instancetype)init;
Return Value
an IMAAdsLoader instance with default IMASettings
-
Request ads from the ad server. The loader takes 1-2 seconds to setup on init and become ready
to make ad requests. So reusing the same IMAAdsLoader instance is encouraged when making ad
requests in order to minimize ad request times.
Declaration
Objective-C
- (void)requestAdsWithRequest:(nonnull IMAAdsRequest *)request;
Parameters
request
|
the IMAAdsRequest. If it was created for use with Picture-in-Picture, this
IMAAdsLoader instance’s IMASettings must have backround playback enabled
|
-
Request a stream with ads inserted dynamically. Reusing the same IMAAdsLoader instance is
encouraged when making stream requests in order to minimize stream request latency.
Declaration
Objective-C
- (void)requestStreamWithRequest:(nonnull IMAStreamRequest *)request;
-
Signal to the SDK that the content has completed. The SDK will play
post-rolls at this time, if any are scheduled.
Declaration
Swift
func contentComplete()
Objective-C
- (void)contentComplete;
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.
[null,null,["Last updated 2025-08-20 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eIMAAdsLoader\u003c/code\u003e class is used to request ads from the ad server and handles ad loading with its delegate.\u003c/p\u003e\n"],["\u003cp\u003eReusing the same \u003ccode\u003eIMAAdsLoader\u003c/code\u003e instance is recommended for faster ad requests and stream requests.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eIMAAdsLoader\u003c/code\u003e can be initialized with custom settings or default settings using its designated initializers.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003erequestAdsWithRequest:\u003c/code\u003e and \u003ccode\u003erequestStreamWithRequest:\u003c/code\u003e are used to request ads and streams with ads, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003econtentComplete\u003c/code\u003e method signals the end of content, prompting the SDK to play any scheduled post-roll ads.\u003c/p\u003e\n"]]],["The `IMAAdsLoader` class facilitates ad requests from an ad server. Key actions include: initializing the loader with default or specific settings, accessible through the `settings` property; using a `delegate` to receive callbacks; and requesting ads via `requestAdsWithRequest:` or streams via `requestStreamWithRequest:`. The class also offers a method to retrieve the SDK version (`sdkVersion`) and signals the end of content with `contentComplete`. Reusing the same loader instance minimizes ad request times.\n"],null,["# GoogleInteractiveMediaAds Framework Reference\n\nIMAAdsLoader\n============\n\n @interface IMAAdsLoader : NSObject\n\nThe IMAAdsLoader class allows the requesting of ads from the ad server.\nUse the delegate to receive the loaded ads or loading error\nin case of failure.\n- `\n ``\n ``\n `\n\n ### [settings](#/c:objc(cs)IMAAdsLoader(py)settings)\n\n `\n ` \n SDK-wide settings. Note that certain settings will only be evaluated during initialization of\n the adsLoader. \n\n #### Declaration\n\n Swift \n\n @NSCopying var settings: ../Classes/IMASettings.html { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly) ../Classes/IMASettings.html *_Nonnull settings;\n\n- `\n ``\n ``\n `\n\n ### [delegate](#/c:objc(cs)IMAAdsLoader(py)delegate)\n\n `\n ` \n Delegate that receives IMAAdsLoaderDelegate callbacks. \n\n #### Declaration\n\n Swift \n\n weak var delegate: (any ../Protocols/IMAAdsLoaderDelegate.html)? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) id\u003c../Protocols/IMAAdsLoaderDelegate.html\u003e delegate;\n\n- `\n ``\n ``\n `\n\n ### [+sdkVersion](#/c:objc(cs)IMAAdsLoader(cm)sdkVersion)\n\n `\n ` \n Returns the SDK version. \n\n #### Declaration\n\n Swift \n\n class func sdkVersion() -\u003e String\n\n Objective-C \n\n + (nonnull NSString *)sdkVersion;\n\n #### Return Value\n\n the SDK version\n- `\n ``\n ``\n `\n\n ### [-initWithSettings:](#/c:objc(cs)IMAAdsLoader(im)initWithSettings:)\n\n `\n ` \n Initializes an IMAAdsLoader with specific settings. The loader takes 1-2 seconds to setup once\n initialized, therefore reusing a single instance of the ads loader is encouraged to minimize ad\n request times. \n\n #### Declaration\n\n Swift \n\n init(settings: ../Classes/IMASettings.html?)\n\n Objective-C \n\n - (nonnull instancetype)initWithSettings:(nullable ../Classes/IMASettings.html *)settings;\n\n #### Parameters\n\n |------------------|-----------------------------------------------------------------------|\n | ` `*settings*` ` | the IMASettings to use for SDK wide settings. Uses defaults when nil. |\n\n #### Return Value\n\n an IMAAdsLoader instance with given IMASettings\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)IMAAdsLoader(im)init)\n\n `\n ` \n Initializes the IMAAdsLoader with default settings. The loader takes 1-2 seconds to setup once\n initialized, therefore reusing a single instance of the ads loader is encouraged to minimize ad\n request times. \n\n #### Declaration\n\n Swift \n\n init()\n\n Objective-C \n\n - (nonnull instancetype)init;\n\n #### Return Value\n\n an IMAAdsLoader instance with default IMASettings\n- `\n ``\n ``\n `\n\n ### [-requestAdsWithRequest:](#/c:objc(cs)IMAAdsLoader(im)requestAdsWithRequest:)\n\n `\n ` \n Request ads from the ad server. The loader takes 1-2 seconds to setup on init and become ready\n to make ad requests. So reusing the same IMAAdsLoader instance is encouraged when making ad\n requests in order to minimize ad request times. \n\n #### Declaration\n\n Swift \n\n func requestAds(with request: ../Classes/IMAAdsRequest.html)\n\n Objective-C \n\n - (void)requestAdsWithRequest:(nonnull ../Classes/IMAAdsRequest.html *)request;\n\n #### Parameters\n\n |-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*request*` ` | the IMAAdsRequest. If it was created for use with Picture-in-Picture, this IMAAdsLoader instance's IMASettings must have backround playback enabled |\n\n- `\n ``\n ``\n `\n\n ### [-requestStreamWithRequest:](#/c:objc(cs)IMAAdsLoader(im)requestStreamWithRequest:)\n\n `\n ` \n Request a stream with ads inserted dynamically. Reusing the same IMAAdsLoader instance is\n encouraged when making stream requests in order to minimize stream request latency. \n\n #### Declaration\n\n Swift \n\n func requestStream(with request: ../Classes/IMAStreamRequest.html)\n\n Objective-C \n\n - (void)requestStreamWithRequest:(nonnull ../Classes/IMAStreamRequest.html *)request;\n\n #### Parameters\n\n |-----------------|--------------------|\n | ` `*request*` ` | the stream request |\n\n- `\n ``\n ``\n `\n\n ### [-contentComplete](#/c:objc(cs)IMAAdsLoader(im)contentComplete)\n\n `\n ` \n Signal to the SDK that the content has completed. The SDK will play\n post-rolls at this time, if any are scheduled. \n\n #### Declaration\n\n Swift \n\n func contentComplete()\n\n Objective-C \n\n - (void)contentComplete;"]]