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:
- Implement the Delegate
- Load Banner Ad
- Destroy the Banner Ad
- 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:
#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;
/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()
Step 2. Load Banner Ad
To load a banner ad, call the following method:
[IronSource loadBannerWithViewController:YOUR_VIEW_CONTROLLER size:YOUR_BANNER_AD_SIZE];
IronSource.loadBanner(with: YOUR_VIEW_CONTROLLER, size: .YOUR_BANNER_AD_SIZE)
loadBannermethod. See table below.
Best for Phones & Tablets
|IS_AD_SIZE_RECTANGLE_BANNER||Large Rectangular Banner
Best for Scrollable Feeds or Between Game Levels
Best for Tablets and Larger Devices
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:
[IronSource loadBannerWithViewController:YOUR_VIEW_CONTROLLER size:YOUR_BANNER_SIZE placement:YOUR_PLACEMENT_NAME];
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:
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.
[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
Step 4. Integrate a Banner Provider
You are now all set up to serve Banners in your application. Verify your integration with our Integration Helper.
Follow our integration guides to integrate additional ad units:
Interested in integrating more mediation adapters? Check out our supported Mediation Networks.