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

    Swift

    @NSCopying var settings: IMASettings! { get }

    Objective-C

    @property (readonly, copy, nonatomic) IMASettings *settings;
  • Delegate that receives IMAAdsLoaderDelegate callbacks.

    Declaration

    Swift

    weak var delegate: IMAAdsLoaderDelegate! { get set }

    Objective-C

    @property (readwrite, nonatomic) id<IMAAdsLoaderDelegate> delegate;
  • Returns the SDK version.

    Declaration

    Swift

    class func sdkVersion() -> String!

    Objective-C

    + (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

    Swift

    init!(settings: IMASettings!)

    Objective-C

    - (instancetype)initWithSettings:(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

    Swift

    init!()

    Objective-C

    - (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

    Swift

    func requestAds(with request: IMAAdsRequest!)

    Objective-C

    - (void)requestAdsWithRequest:(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

    Swift

    func requestStream(with request: IMAStreamRequest!)

    Objective-C

    - (void)requestStreamWithRequest:(IMAStreamRequest *)request;

    Parameters

    request

    the stream 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;