Skip to main content

iOS Banner Integration

Create a Banner Object#

info

If you miss to Initialize the SDK, this method will fail to return a response.

Select the mediation platform:

To implement a Banner bidder object for GAM follow:

//1. import MesonWrapGAM
import MesonWrapGAM
//2. Create a DFPRequest object
private var dfpRequest = DFPRequest()
//3. Create a MesonGAMBanner object and Init with adUnitId and adSize
private var mesonBanner: MesonGAMBanner?
mesonBanner = MesonGAMBanner.init(adUnitId: #adUnitId, adSize: #adSize)

Initialize the SKStoreManager#

Initialize the SKStoreManager as follows:

//Please import the MesonWrapSKAN for CocoaPods integration. For manual please import the files.
var mesonBannerSKStoreManager: MesonBannerSKStoreManager()

Implement a Delegate#

Select the mediation platform:

To implement a delegate for GAM follow:

//Success or failure callbacks
extension <ClassName>: MesonGAMBidFetcherDelegate {
func bidFetched(for ppmAd: DFPRequest) {
// Create a DFPBannerView and call load with DFPRequest
}
func bidFailed(for ppmAd: DFPRequest, with error: Error) {
// Create a DFPBannerView and call load with DFPRequest
}
}

Fetch a Bid#

Select the mediation platform:

To fetch a bid for GAM follow:

// Fetch the Bid using the MesonGAMBanner.fetchBid with delegate MesonGAMBidFetcherDelegate.
mesonBanner?.fetchBid(dfpRequest: dfpRequest, delegate: self)

Submit Signed Clicks to SKAdNetwork#

After successfully loading the Banner Ad, call the following from the load success callback of MoPub / GAM Delegate

self.mesonBannerSKStoreManager.start(adObject: <AdObject>, delegate: self)

Implement the following delegate methods

extension <ClassName>: MesonSkStoreManagerDelegate {
func didFailToLoad(error: Error) {
// SKStore fails to load
}
func didFailToShow(error: Error) {
// SKStore fails to show
}
func didShow(skStore: UIViewController) {
// SKStore successfully shown with the view controller
}
func willDismiss(skStore: UIViewController) {
// Successfully closed the SKStore view controller
}
}
What Next?

Next, let's integrate Interstitial ad units, or Manage Demand and Configure your Ad Server.