SASAdView

Objective-C

@interface SASAdView : UIView

Swift

class SASAdView : UIView

The SASAdView class provides a view that automatically loads and displays a creative.

Warning

This class should never be instantiated and used directly, use the SASBannerView class instead.

Note

Starting to SDK 7.0.0, there isn’t any public SASInterstitialView anymore. Use a SASInterstitialManager or a SASRewardedVideoManager to load and display an interstitial ad and the underlying interstitial view will be instantiated and handled for you automatically.

Ad view properties

  • The modal parent view controller is used to present the modal view controller following the ad’s click.

    Note

    You should always set a valid modal parent view controller, otherwise most post-click interactions will not be able to work properly (post-click modal, StoreKit, …).

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) UIViewController *modalParentViewController;

    Swift

    weak var modalParentViewController: UIViewController? { get set }
  • YES if the ad is displayed using a web view for the rendering, NO if the ad is using native components.

    Declaration

    Objective-C

    @property (readonly) BOOL webViewRendering;

    Swift

    var webViewRendering: Bool { get }

Loading ad data

  • Fetches an ad from Smart.

    Call this method after initializing your SASAdView object to load the appropriate SASAd object from the server.

    Declaration

    Objective-C

    - (void)loadWithPlacement:(nonnull SASAdPlacement *)placement;

    Swift

    func load(with placement: SASAdPlacement)

    Parameters

    placement

    The ad placement that should be used for the call.

  • Fetches an ad from Smart and create in-app bidding competition.

    Call this method after initializing your SASAdView object to load the appropriate SASAd object from the server.

    Declaration

    Objective-C

    - (void)loadWithPlacement:(nonnull SASAdPlacement *)placement
                bidderAdapter:(nullable id<SASBidderAdapterProtocol>)bidderAdapter;

    Swift

    func load(with placement: SASAdPlacement, bidderAdapter: (any SASBidderAdapterProtocol)?)

    Parameters

    placement

    The ad placement that should be used for the call.

    bidderAdapter

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

  • Loads a new ad using the last placement provided to the loadWithPlacement: method.

    Warning

    This method will fail if called before any ad loading, if the ad view is not attached to the view hierarchy, or if a bidding reponse is currently being displayed.

    Declaration

    Objective-C

    - (void)refresh;

    Swift

    func refresh()

Communication with the creative

  • Sends a message to the web view hosting the creative (if any).

    The message can be retrieved in the creative by adding an MRAID event listener on the ‘sasMessage’ event. It will not be sent if the creative is not fully loaded.

    Declaration

    Objective-C

    - (void)sendMessageToWebView:(nonnull NSString *)message;

    Swift

    func sendMessageToWebView(_ message: String)

    Parameters

    message

    A non empty message that will be sent to the creative.