Banner Integration for iOS

Banners are a rectangular, system-initiated ads that can be either static or animated, and are served in a designated area around your live app content.

Serve Banner Ads through ironSource Mediation in a few easy steps:

  1. Implement the Delegate
  2. Load Banner Ad
  3. Destroy the Banner Ad
  4. Integrate a Banner Provider

Before You Start

  • Make sure you have correctly integrated the ironSource SDK into your application. Integration is outlined here.
  • Banner Mediation is supported in ironSource SDK 6.6.0 and above.

Step 1. Implement the Delegate

The ironSource SDK fires several Delegates to inform you of Banner activity. The SDK will notify your Delegate of all possible events listed below:

OBJECTIVE-C

#pragma mark - ISBannerDelegate
/** Called after a banner ad has been successfully loaded
 */
- (void)bannerDidLoad:(UIView *)bannerView;
/**
 Called after a banner has attempted to load an ad but failed.
 
 @param error The reason for the error
 */
- (void)bannerDidFailToLoadWithError:(NSError *)error;
/**
 Called after a banner has been clicked.
 */
- (void)didClickBanner;
/**
 Called when a banner is about to present a full screen content.
 */
- (void)bannerWillPresentScreen;
/**
 Called after a full screen content has been dismissed.
 */
- (void)bannerDidDismissScreen;
/**
 Called when a user would be taken out of the application context.
 */
- (void)bannerWillLeaveApplication;

SWIFT

/MARK: Banner Delegates
    
   /**
     Called after a banner ad has been successfully loaded
     */
    func bannerDidLoad(_ bannerView: ISBannerView!)
    
   /**
     Called after a banner has attempted to load an ad but failed.
     @param error The reason for the error
     */
    func bannerDidFailToLoadWithError(_ error: Error!)
   /**
     Called after a banner has been clicked.
     */
    func didClickBanner()
    
   /**
     Called when a banner is about to present a full screen content.
     */
    func bannerWillPresentScreen()
   /**
     Called after a full screen content has been dismissed.
     */
    func bannerDidDismissScreen()
    
   /**
     Called when a user would be taken out of the application context.
     */
    func bannerWillLeaveApplication()
Note: Do not assume the callbacks are always running on the main thread. Any UI interaction or updates resulting from ironSource callbacks need to be passed to the main thread before executing.

Step 2. Load Banner Ad

To load a banner ad, call the following method:

OBJECTIVE-C

[IronSource loadBannerWithViewController:YOUR_VIEW_CONTROLLER size:YOUR_BANNER_AD_SIZE];

SWIFT

IronSource.loadBanner(with: YOUR_VIEW_CONTROLLER, size: .YOUR_BANNER_AD_SIZE)
Note: You must define one of banner sizes we support to call the loadBanner method. See table below.
bannerSize Description Dimensions
IS_AD_SIZE_BANNER Standard Banner
Best for Phones & Tablets
320X50
 IS_AD_SIZE_LARGE_BANNER Large Banner 320X90
IS_AD_SIZE_RECTANGLE_BANNER Large Rectangular Banner
Best for Scrollable Feeds or Between Game Levels
300X250
IS_AD_SIZE_TABLET_BANNER Tablet Banner
Best for Tablets and Larger Devices
728X90

We support placements for Banner Mediation, as well as capping and pacing for Banners on the ironSource dashboard. Learn how to set up placements, capping and pacing for Banners to optimize your app’s user experience here.

If you’ve set up placements for your Banner, call the following method to serve a Banner ad in a specific placement:

OBJECTIVE-C

[IronSource loadBannerWithViewController:YOUR_VIEW_CONTROLLER size:YOUR_BANNER_SIZE placement:YOUR_PLACEMENT_NAME];

SWIFT

IronSource.loadBanner(with: YOUR_VIEW_CONTROLLER, size: YOUR_BANNER_SIZE, placement: YOUR_PLACEMENT_NAME)

 

Once you receive the below callback from your Delegate, you will be able to show the ad to your users:

OBJECTIVE-C

(void)bannerDidLoad:(ISBannerView *)bannerView

SWIFT

func bannerDidLoad(_ bannerView: ISBannerView!)

Step 3. Destroy the Banner Ad

Once you’ve successfully served a Banner, you must call the below function on the main thread to destroy the previous Banner. This is necessary to serve an additional Banner in the same view.

OBJECTIVE-C

[IronSource destroyBanner: YOUR_IRONSOURCE_BANNER];

SWIFT

IronSource.destroyBanner(YOUR_IRONSOURCE_BANNER)

After you call this method, the Banner in question can no longer be used. In the case you want to serve it again, you will need to load a new Banner using the loadBanner method.

Step 4.  Integrate a Banner Provider

Next, integrate the ad network adapters to serve Banners through ironSource Mediation. We currently support Admob and Facebook Banners.

 

Done!
You are now all set up to serve Banners in your application. Verify your integration with our Integration Helper.


What’s Next? 

Follow our integration guides to integrate additional ad units:

 

Interested in integrating more mediation adapters? Check out our supported Mediation Networks.