SASNativeAdManager

Objective-C

@interface SASNativeAdManager : NSObject

Swift

class SASNativeAdManager : NSObject

A SASNativeAdManager instance can be used to request a native ad object from Smart delivery.

Each SASNativeAdManager instance corresponds to a placement, represented by a configuration.

Warning

When a native ad is retrieved through a manager, this native ad must be used then discarded before releasing the manager or loading a new ad. Failing to do so can lead to several issues, like the ad becoming non clickable.
  • Initializes a new SASNativeAdManager instance.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPlacement:(nonnull SASAdPlacement *)placement;

    Swift

    init(placement: SASAdPlacement)

    Parameters

    placement

    Represents the placement’s configuration that will be used by the SASNativeAdManager.

    Return Value

    An initialized instance of SASNativeAdManager.

  • Requests a native ad from Smart.

    Note

    You can request only one ad at the same time. If you try to request another ad before the call to the completion block, it will fail with an error.

    Declaration

    Objective-C

    - (void)requestAd:(nonnull SASNativeRequestCompletionBlock)completionBlock;

    Swift

    func requestAd() async throws -> SASNativeAd

    Parameters

    completionBlock

    The block that will be called when the ad request is finished.

  • Requests a native ad from Smart.

    Note

    You can request only one ad at the same time. If you try to request another ad before the call to the completion block, it will fail with an error.

    Declaration

    Objective-C

    - (void)requestAdWithBidderAdapter:
                (nullable id<SASBidderAdapterProtocol>)bidderAdapter
                            completion:(nonnull SASNativeRequestCompletionBlock)
                                           completionBlock;

    Swift

    func requestAd(withBidderAdapter bidderAdapter: SASBidderAdapterProtocol?) async throws -> SASNativeAd

    Parameters

    bidderAdapter

    The bidder adapter created from the result of the in-app bidding competition.

    completionBlock

    The block that will be called when the ad request is finished.

  • Returns an initialized SASNativeAdManager object.

    Declaration

    Objective-C

    + (nonnull instancetype)nativeAdManagerWithPlacement:
        (nonnull SASAdPlacement *)placement;

    Parameters

    placement

    Represents the placement’s configuration that will be used by the SASNativeAdManager.

    Return Value

    An initialized instance of SASNativeAdManager.