Implement BIDBannerViewDelegate so that you are notified of when your ad is ready and of other ad-related events.
#pragma mark - BIDBannerViewDelegate protocol methods
- (void)bannerDidDisplay:(BIDBannerView *)banner adInfo:(BIDAdInfo *)adInfo
{
NSLog(@"Banner - did display ad. BannerView: %@, AdInfo: %@", banner, adInfo);
}
- (void)bannerDidFailToDisplay:(BIDBannerView *)banner adInfo:(BIDAdInfo *)adInfo error:(NSError *)error
{
NSLog(@"Banner - did fail to display ad. BannerView: %@, Error: %@", banner, error);
}
- (void)bannerDidClick:(BIDBannerView *)banner adInfo:(BIDAdInfo *)adInfo
{
NSLog(@"Banner - did click. BannerView: %@, AdInfo: %@", banner, adInfo);
}
- (void)allNetworksFailedToDisplayAdInBanner:(BIDBannerView *)banner
{
NSLog(@"Banner - allNetworksFailedToDisplayAdInBanner: %@", banner);
}
//This method is called by the auto-load algorithm only. It is not called during refresh or autorefresh.
- (void)bannerDidLoad:(BIDBannerView *)banner adInfo:(BIDAdInfo *)adInfo
{
NSLog(@"Banner - did load ad. BannerView: %@, AdInfo: %@", banner, adInfo);
}
//BIDBannerViewDelegate protocol methodsfuncbannerDidDisplay(_banner: BIDBannerView, adInfo: BIDAdInfo) {print("Banner - did display ad. BannerView: \(banner) AdInfo: \(adInfo)")}funcbannerDidFail(toDisplaybanner: BIDBannerView, adInfo: BIDAdInfo, error: Error) {print("Banner - did fail to display ad. BannerView: \(banner) AdInfo: \(adInfo) Error: \(error)")}funcbannerDidClick(_banner: BIDBannerView, adInfo: BIDAdInfo) {print("Banner - did click. BannerView: \(banner) AdInfo: \(adInfo)")}funcallNetworksFailedToDisplayAd(inBannerbanner: BIDBannerView) {print("Banner - allNetworksFailedToDisplayAd. BannerView: \(banner)")}//This method is called by the auto-load algorithm only. It is not called during refresh or autorefresh.funcbannerDidLoad(_banner: BIDBannerView, adInfo: BIDAdInfo) {print("Banner - did load ad. BannerView: \(banner) AdInfo: \(adInfo)")}
Stopping and Starting Auto-Refresh
There may be cases when you would like to stop auto-refresh, for instance, when you hide a banner ad or want to manually refresh.
Stop auto-refresh for a banner ad with the following code:
[bidBannerView stopAutorefresh];
bidBannerView.stopAutorefresh()
Start auto-refresh for a banner ad with the following code:
[bidBannerView startAutorefresh:30.0];
bidBannerView.startAutorefresh(30.0)
Manually refresh the contents with the following code. You must stop auto-refresh prior to calling refreshAd.
[bidBannerView refreshAd];
bidBannerView.refreshAd()
Stopping and Starting Auto-Load
By default, banners preload ads before any refresh attempt. So it is possible for a banner to use already preloaded ads instead of loading new ads during refresh attempts. To disable this feature you need to call the following method: