Multiple

Designed for lists or waterfall-type layouts.

This guide will show you how to use the Adx3 Ads SDK to implement multiple ads in an iOS app.

Prerequisites

Always test with test ads

When building and testing your apps, make sure you use test ads rather than live, production ads. Failure to do so can lead to the suspension of your account. The easiest way to load test ads is to use our dedicated test ad unit ID for ads on iOS:

63a573c07144f

It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging. Just make sure you replace it with your own ad unit ID before publishing your app.

Implementation

  • Load an ad

  • Create an Adx3CustomAdView

  • Display the ad

Load an ad

Loading an ad is accomplished using the static loadCustomAdWithPlacementID: userId: success: error: method on the Adx3CustomAdManager class. The load method requires your ad unit ID, a userId object, and a completion handler which gets called when ad loading succeeds or fails. userId object can not be passed or your custom for user identifier. The below example shows how to load a ad.

func loadCustomAd() {    
    Adx3CustomAdManager().loadCustomAd(withPlacementID: "Your Placement ID", userId: "") { adCount in
    
    } error: { error in
            
    }
}

Create a Adx3CustomAdView

You must custom your own Adx3CustomAdView, the relevant sub-controls have been declared for you, The layout needs to be defined manually by yourself.

Display the ad

To display multiple ads, you need to call the loadCustomAdView: index: location: method on Adx3CustomAdManager class. This method requires you to provide a custom Adx3CustomAdView, and the index is the subscript of Adx3CustomAdView. location is the location on the screen when you touch Adx3CustomAdView, the purpose is to provide you with more accurate multiple advertisement services.

Last updated