Menu

Banner ads

1. Introduction

Banner ads provide ads in the form of View, at the bottom or top of the content Small bar ads displayed.

1.1 Integration suggestions

1. Load ads

    • To load ads through loadADWithPlacementID , please call the loading method in advance to request the ad (for example, you can preload the ad after opening the screen) so that it can be displayed quickly when the ad needs to be triggered.
    • View can customize the width and height, but some advertising platforms may not be able to adapt to the customized width and height, so the set width and height must be proportional to the aspect ratio configured in the TopOn background. Equal proportions, specific adjustments need to be made after testing to see the actual effect. temporarily hideremove it from the screen.

2. Display ads

    • Please call bannerAdReadyForPlacementID before displaying strong> Determine whether the ad is ready
      • YES: Call retrieveBannerViewForPlacementID to obtain the ad view for display
      • NO: You need to decide whether to give up the impression and preload the next ad based on your needs. Or reload the ad and wait for it to be displayed after success
    • ATBannerView object can be reused and does not need to be recreated each time it is loaded and displayed.

3. Ad preloading

    • After the banner ad is displayed, you can call loadADWithPlacementID in the callback of didShowAdWithPlacementID after the ad is displayed to perform preloading, which will help increase the display volume of higher priority ad sources.
    • If the automatic refresh function has been turned on in the background, you do not need to do the preloading logic yourself.

4. Preset strategy

    • It is recommended to configure a preset strategy: to improve the ad loading effect for the first cold start. For specific instructions and access tutorials, see SDK Preset Strategy Instructions.

1.2 Notes

    • Prohibited in didFailToLoadADWithPlacementID callback Method to perform ad loading, otherwise it will cause a lot of useless requests and may cause the application to freeze.
    • Banner provides an automatic refresh function, which is enabled by default. You can configure the refresh time or not to refresh in the Advanced Settings of the TopOn backend ad slot. , the specific logic of the function is as follows:
      • The View of the banner ad must have been added to the ViewController and the visual state will be automatically refreshed
      • The automatic refresh timing will not stop when the Banner is hidden
      • If the time between hiding and re-display exceeds the refresh time , when the Banner is re-displayed, load will be called directly to refresh
    • Enable the automatic refresh function of the banner ad space, and the developer only needs to call load once , add ATBannerView to your layout after loading successfully. After ensuring that it is visible, subsequent display and refresh will be automatically performed by the SDK
    • Close the following ads uniformly The automatic refresh function of the platform: Inmobi, Mintegral, Tencent Ads, TT(CSJ), Pangle. If automatic refresh is needed, developers are asked to use the automatic refresh function of the TopOn background.
    • Be careful when integrating Mintegral's Banner ads. You must first add ATBannerView to the placement and it must be in a visible state, and then load the ads to obtain the ads normally. .
    • Developers can control display and hiding through ATBannerView's isHidden as needed
    • No need When displaying Banner, please remove ATBannerView and use the ATBannerView = nil method to destroy the current advertising resources
    • It is not recommended to load ads when the App is in the background to avoid Unnecessary exceptions caused by system recycling of resources

2. API description

2.1 Loading ads

ATAdManager: Banner ad management class

MethodDescription
sharedManagerGet ATAdManager singleton object
loadADWithPlacementID: extra: delegate:Interstitial loading method
placementId: TopOn's advertising slot id
extra: local configuration parameters
delegate: delegate object

Issues that need attention when loading:

    • It is best to choose the same or similar proportions for each ad source size under the banner ad slot
    • Before calling the load method to load the ad, you need to specify the frame of the ATBannerView Width and height

Call code example

#import <AnyThinkBanner/AnyThinkBanner.h>

- (void)loadBannerAdView {
    // Here, the aspect ratio 320*50 equal scale scaling is used as an example
    CGSize size = CGSizeMake([UIScreen mainScreen].bounds.size.width, ([UIScreen mainScreen].bounds.size.width * 50) / 320); 
    
    NSDictionary *extra = @{ kATAdLoadingExtraBannerAdSizeKey : [NSValue valueWithCGSize:size], }; 
    [[ATAdManager sharedManager] loadADWithPlacementID:@"your banner placementID" extra:extra delegate:self];
}

2.1.1 Admob size adaptation

For Admob platform supports Admob banner ad adaptation. First, the Admob SDK header file is introduced:

#import <GoogleMobileAds/GoogleMobileAds.h>

Then get the Admob banner adaptive GADAdSize, then pass in extra kATAdLoadingExtraAdmobBannerSizeKey and kATAdLoadingExtraAdmobAdSizeFlagsKey Just set it up. An example is as follows:

//GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth self-adaptation
//GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth Portrait screen
//GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth landscape

// The example is a full screen width
GADAdSize admobSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(CGRectGetWidth(self.view.bounds));

[[ATAdManager sharedManager] loadADWithPlacementID:@"your banner placementID" 
            extra:@{kATAdLoadingExtraBannerAdSizeKey:[NSValue valueWithCGSize:CGSizeMake(CGRectGetWidth(self.view.bounds), 250.0f)],
                        kATAdLoadingExtraAdmobBannerSizeKey:[NSValue valueWithCGSize:admobSize.size],
                        kATAdLoadingExtraAdmobAdSizeFlagsKey:@(admobSize.flags)} delegate:self];

2.2 Display Advertisement

MethodDescription
retrieveBannerViewForPlacementID:Get banner ad view
placementId: TopOn's advertising slot id
retrieveBannerViewForPlacementID: scene:Get the banner ad view
placementId: TopOn's ad slot id
scene: scene id, no space can be passed @""
bannerAdReadyForPlacementID:Determine whether there are currently ads that can be displayed
placementId: TopOn's advertising slot id

Call the sample code

-(void) showBanner {
    // Check to see if the AD is ready before showing
    if ([[ATAdManager sharedManager] bannerAdReadyForPlacementID:@"your banner placementID"]) {
         // Remove any old Bannerviews that may exist
        NSInteger tag = 3333;
        [[self.view viewWithTag:tag] removeFromSuperview];
        
         //Retrieve banner view
        ATBannerView *bannerView = [[ATAdManager sharedManager] retrieveBannerViewForPlacementID:@"your banner placementID"];
        if (bannerView != nil) {
            bannerView.delegate = self;
            bannerView.presentingViewController = self;
            bannerView.translatesAutoresizingMaskIntoConstraints = NO;
            bannerView.tag = tag;
            [self.view addSubview:bannerView];
            //Layour banner
            [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:bannerView attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:.0f]];
            [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0f constant:CGRectGetHeight([UIApplication sharedApplication].statusBarFrame) + CGRectGetHeight(self.navigationController.navigationBar.frame)]];
            [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:_adSize.width]];
            [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:_adSize.height]];
        } else {
        NSLog(@"Banner ad's not ready for placementID:%@", @"your banner placementID");
    }
}

2.2.1 Native self-rendering spell banner

If the banner AD space is configured to use native self-rendered ads as banners, please refer to the following code to integrate:

Note: Please select native banner ads for Meta(Facebook) platform ads.

-(void) showBanner {
    // Determine if the AD is ready before showing it
    if ([[ATAdManager sharedManager] bannerAdReadyForPlacementID:@"your banner placementID"]) {
         // Remove any old Bannerviews that may exist
        NSInteger tag = 3333;
        [[self.view viewWithTag:tag] removeFromSuperview];
         //Retrieve banner view
        
        ATShowConfig *showConfig = ATShowConfig.new; 
        showConfig.scene = @"your scene id"; 
        showConfig.showCustomExt = @"testShowCustomExt"; 
        __weak __typeof(self)weakSelf = self; 
        
        ATBannerView *bannerView = [[ATAdManager sharedManager] retrieveBannerViewForPlacementID:@"your banner ad id" 
                                                                                                config:showConfig 
                                                                                                nativeMixBannerViewBlock:^(ATNativeBannerView * _Nonnull nativeBannerView) { 
                                                                                                    // Constraining the positions of controls in ATNativeBannerView
                                                                                                    [weakSelf developerSlefRender:nativeBannerView]; 
                                                                                                }];
        
        if (bannerView != nil) {
            bannerView.delegate = self;
            bannerView.presentingViewController = self;
            bannerView.translatesAutoresizingMaskIntoConstraints = NO;
            bannerView.tag = tag;
            [self.view addSubview:bannerView];
            //Layour banner
            [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:bannerView attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:.0f]];
            [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0f constant:CGRectGetHeight([UIApplication sharedApplication].statusBarFrame) + CGRectGetHeight(self.navigationController.navigationBar.frame)]];
            [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:_adSize.width]];
            [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:_adSize.height]];
        } else {
        NSLog(@"Banner ad's not ready for placementID:%@", @"your banner placementID");
    }
}
 
 - (void)developerSlefRender:(ATNativeBannerView *)nativeBannerView {

    [nativeBannerView.textLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(nativeBannerView);
        make.right.mas_equalTo(nativeBannerView);
        make.height.mas_equalTo(30);
        make.bottom.mas_equalTo(nativeBannerView.mas_bottom).offset(-5);
    }];

    [nativeBannerView.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(nativeBannerView);
        make.right.mas_equalTo(nativeBannerView);
        make.height.mas_equalTo(30);
        make.bottom.mas_equalTo(nativeBannerView.textLabel.mas_top).offset(-5);
    }];

    NSMutableArray *regisArray = [NSMutableArray array];

    if (nativeBannerView.textLabel) {
        [regisArray addObject:nativeBannerView.textLabel];
    }
    
    if (nativeBannerView.titleLabel) {
        [regisArray addObject:nativeBannerView.titleLabel];
    }
    [nativeBannerView registerClickableViewArray:regisArray];
}

2.3 Scene statistics

Statistics on the probability of users reaching the scene, and present the data report in the background-> Funnel analysis report-> reaches the advertising scene, so it is recommended that developers call it in the right place.

MethodDescription
entryBannerScenarioWithPlacementID: scene:The corresponding advertising space enters the business scene cache status statistics placementId: advertising space Id scene: advertising display scene, the scene parameters can be created from the background, please refer to Business scenario cache status statistics

Scenario statistics call example:

/* To collect scene arrival rate statistics, you can view related information https://docs.toponad.com/#/zh-cn/ios/NetworkAccess/scenario/scenario 
Call the "Enter AD scene" method when an AD trigger condition is met, such as: 
** The scenario is a pop-up AD after the cleanup, which is called at the end of the cleanup. 
* 1、Call entryXXX to report the arrival of the scene. 
* 2、Call xxRewardedVideoReadyForPlacementID. 
* 3、Call showXX to show AD view. 
* (Note the difference between auto and manual) */ 
[[ATAdManager sharedManager] entryBannerScenarioWithPlacementID:@"your banner placement id" scene:@"your scenarioID"];
    
if ([[ATAdManager sharedManager] bannerAdReadyForPlacementID:@"your banner placement id"]) {
    ATBannerView *bannerView = [[ATAdManager sharedManager] retrieveBannerViewForPlacementID:@"your banner placement id" scene:@"your scenarioID"];
}

2.4 Remove banner ads

If necessary, use the following code to remove Banner from the screen:

[self.bannerView removeFromSuperview];
self.bannerView = nil;

If you only want to temporarily hide the Banner (rather than remove it from the screen), the simulation scenario is that interface A is transferred to interface B, at this time you need to hide the banner AD of interface A, and then switch back to interface A to display the banner AD. Please use the code here:

self.bannerView.hidden = YES;

After hiding the Banner, You can redisplay it using the following code:

self.bannerView.hidden = NO;

2.5 Delegate callback

ATAdLoadingDelegate delegate method

MethodDescription
didFinishLoadingADWithPlacementID: corresponds to advertising slot id Loading success callback
placementId: Advertisement slot Id
didFailToLoadADWithPlacementID: error:Corresponding to advertising slot id loading failure callback
placementId: advertising slot Id
error: advertising loading failure information
didStartLoadingADSourceWithPlacementID: extra :corresponds to A callback for an advertising source in the advertising slot id to start loading ads
placementId: advertising slot Id
extra: additional advertising parameters
didFinishLoadingADSourceWithPlacementID: extra:Corresponding to An advertising source in the advertising slot id successfully loads the advertisement Callback
placementId: Advertising slot Id
extra: Advertising additional parameters
didFailToLoadADSourceWithPlacementID: extra: error:corresponds toa certain advertising source in the advertising slot id callback for failure to load ads
placementId: advertising slot Id
extra : Advertising additional parameters
error: Ad loading failure information
didStartBiddingADSourceWithPlacementID: extra:corresponds to An advertising source in the advertising slot id Callback for the start of bidding for ads
placementId: Advertising slot Id
extra: Advertising additional parameters
didFinishBiddingADSourceWithPlacementID: extra:corresponds to An advertising source in the advertising slot id Callback for successful advertising bidding
placementId: Advertising slot Id
extra: Advertising additional parameters
didFailBiddingADSourceWithPlacementID: extra: error:Corresponds to a certain advertising source in the advertising slot id Callback for bidding failure of bidding ads
placementId: Advertising slot Id
extra: Advertising additional parameters
error: Bidding advertising failure information

ATBannerDelegate delegate method

MethodDescription
bannerView:failedToAutoRefreshWithPlacementID: error:bannerView automatic refresh failed
bannerView:didShowAdWithPlacementID:extra:bannerView displays results
bannerView:didClickWithPlacementID:extra :bannerView click
bannerView:didCloseWithPlacementID:extra:bannerView closed
bannerView:didAutoRefreshWithPlacement:extra:bannerView automatically refreshes
bannerView:didTapCloseButtonWithPlacementID: extra:bannerView clicks the close button
bannerView:didDeepLinkOrJumpForPlacementID: extra:result:Whether the bannerView click jump is in Deeplink form, currently only for TopOn Adx's advertising return
extra:Extended parameter reference Documentation

Call code example

#pragma mark - loading delegate methods
- (void)didStartLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
    NSLog(@"ADSource--AD--Start--ATBannerViewController::didStartLoadingADSourceWithPlacementID:%@---extra:%@", placementID,extra);
}

- (void)didFinishLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
    NSLog(@"ADSource--AD--Finish--ATBannerViewController::didFinishLoadingADSourceWithPlacementID:%@---extra:%@", placementID,extra);
}

- (void)didFailToLoadADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error {
    NSLog(@"ADSource--AD--Fail--ATBannerViewController::didFailToLoadADSourceWithPlacementID:%@---error:%@", placementID,error);
}

// bidding
- (void)didStartBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
    NSLog(@"ADSource--bid--Start--ATBannerViewController::didStartBiddingADSourceWithPlacementID:%@---extra:%@", placementID,extra);
}

- (void)didFinishBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
    NSLog(@"ADSource--bid--Finish--ATBannerViewController::didFinishBiddingADSourceWithPlacementID:%@--extra:%@", placementID,extra);
}

- (void)didFailBiddingADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error {
    NSLog(@"ADSource--bid--Fail--ATBannerViewController::didFailBiddingADSourceWithPlacementID:%@--error:%@", placementID,error);
}

- (void) didFinishLoadingADWithPlacementID:(NSString *)placementID {
    NSLog(@"ATBannerViewController::didFinishLoadingADWithPlacementID:%@", placementID);
}

-(void) didFailToLoadADWithPlacementID:(NSString*)placementID error:(NSError*)error {
    NSLog(@"ATBannerViewController::didFailToLoadADWithPlacementID:%@ error:%@", placementID, error);
}

#pragma mark - banner delegate
- (void)bannerView:(ATBannerView*)bannerView didShowAdWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didShowAdWithPlacementID:%@ with extra: %@", placementID,extra);
}

- (void)bannerView:(ATBannerView*)bannerView didClickWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra{
    NSLog(@"ATBannerViewController::bannerView:didClickWithPlacementID:%@ with extra: %@", placementID,extra);
}

- (void)bannerView:(ATBannerView*)bannerView didAutoRefreshWithPlacement:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didAutoRefreshWithPlacement:%@ with extra: %@", placementID,extra);
}

- (void) bannerView:(ATBannerView *)bannerView failedToAutoRefreshWithPlacementID:(NSString *)placementID error:(NSError *)error {
    NSLog(@"ATBannerViewController::bannerView:failedToAutoRefreshWithPlacementID:%@ error:%@", placementID, error);
}

- (void)bannerView:(ATBannerView*)bannerView didTapCloseButtonWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra {
    NSLog(@"ATBannerViewController::bannerView:didTapCloseButtonWithPlacementID:%@ extra: %@", placementID,extra);

    // After receiving the Close button callback, you need to remove bannerView yourself
}

- (void)bannerView:(ATBannerView *)bannerView didDeepLinkOrJumpForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra result:(BOOL)success {
    NSLog(@"ATBannerViewController:: didDeepLinkOrJumpForPlacementID:placementID:%@ with extra: %@, success:%@", placementID,extra, success ? @"YES" : @"NO");
}

2.6 Other API

MethodDescription
getBannerValidAdsForPlacementID:Query the ad slot All cached information, the first item in the array is the advertising data to be displayed.
placementId: the advertising slot Id to be queried
NSArray *array = [[ATAdManager sharedManager] getBannerValidAdsForPlacementID:@"your banner placementID"];
NSLog(@"ValidAds.count:%ld--- ValidAds:%@",array.count,array);

3. Sample code

#import <AnyThinkBanner/AnyThinkBanner.h>

@interface ATBannerViewController () <ATAdLoadingDelegate, ATBannerDelegate>
@end

@implementation ATBannerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadBannerAdView];
}

- (void)loadBannerAdView {
    // Here, the aspect ratio 320*50 equal scale scaling is used as an example
    CGSize size = CGSizeMake([UIScreen mainScreen].bounds.size.width, ([UIScreen mainScreen].bounds.size.width * 50) / 320);
 
    NSDictionary *extra = @{ kATAdLoadingExtraBannerAdSizeKey : [NSValue valueWithCGSize:size], };
    [[ATAdManager sharedManager] loadADWithPlacementID:@"your banner placementID" extra:extra delegate:self];
}

- (void)entryAdScenario {
    /* To collect scene arrival rate statistics, you can view related information https://docs.toponad.com/#/zh-cn/ios/NetworkAccess/scenario/scenario 
    Call the "Enter AD scene" method when an AD trigger condition is met, such as: 
    ** The scenario is a pop-up AD after the cleanup, which is called at the end of the cleanup. 
    * 1、Call entryXXX to report the arrival of the scene. 
    * 2、Call xxRewardedVideoReadyForPlacementID. 
    * 3、Call showXX to show AD view. 
    * (Note the difference between auto and manual) */
    [[ATAdManager sharedManager] entryBannerScenarioWithPlacementID:@"your banner placement id" scene:@"your scenarioID"];
}

- (void)showBanner {
 
    [self entryAdScenario];
    
     // Check to see if the AD is ready before showing
    if ([[ATAdManager sharedManager] bannerAdReadyForPlacementID:@"your banner placementID"]) {
        NSInteger tag = 3333;
        [[self.view viewWithTag:tag] removeFromSuperview];
        
        //Retrieve banner view
        ATBannerView *bannerView = [[ATAdManager sharedManager] retrieveBannerViewForPlacementID:@"your banner placementID" scene:@"your scenarioID"];
        bannerView.delegate = self;
        bannerView.presentingViewController = self;
        bannerView.translatesAutoresizingMaskIntoConstraints = NO;
        bannerView.tag = tag;
        [self.view addSubview:bannerView];
        //Layour banner
        [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:bannerView attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:.0f]];
        [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0f constant:CGRectGetHeight([UIApplication sharedApplication].statusBarFrame) + CGRectGetHeight(self.navigationController.navigationBar.frame)]];
        [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:_adSize.width]];
        [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:_adSize.height]];
    } else {
        NSLog(@"Banner ad's not ready for placementID:%@", @"your banner placementID");
    }
}

#pragma mark - loading delegate method(s)
- (void)didStartLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
    NSLog(@"ADSource--AD--Start--ATBannerViewController::didStartLoadingADSourceWithPlacementID:%@---extra:%@", placementID,extra);
}

- (void)didFinishLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
    NSLog(@"ADSource--AD--Finish--ATBannerViewController::didFinishLoadingADSourceWithPlacementID:%@---extra:%@", placementID,extra);
}

- (void)didFailToLoadADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error {
    NSLog(@"ADSource--AD--Fail--ATBannerViewController::didFailToLoadADSourceWithPlacementID:%@---error:%@", placementID,error);
}

// bidding
- (void)didStartBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
    NSLog(@"ADSource--bid--Start--ATBannerViewController::didStartBiddingADSourceWithPlacementID:%@---extra:%@", placementID,extra);
}

- (void)didFinishBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
    NSLog(@"ADSource--bid--Finish--ATBannerViewController::didFinishBiddingADSourceWithPlacementID:%@--extra:%@", placementID,extra);
}

- (void)didFailBiddingADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error {
    NSLog(@"ADSource--bid--Fail--ATBannerViewController::didFailBiddingADSourceWithPlacementID:%@--error:%@", placementID,error);
}

- (void) didFinishLoadingADWithPlacementID:(NSString *)placementID {
    NSLog(@"ATBannerViewController::didFinishLoadingADWithPlacementID:%@", placementID);
}

-(void) didFailToLoadADWithPlacementID:(NSString*)placementID error:(NSError*)error {
    NSLog(@"ATBannerViewController::didFailToLoadADWithPlacementID:%@ error:%@", placementID, error);
}

#pragma mark - banner delegate
- (void)bannerView:(ATBannerView*)bannerView didShowAdWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didShowAdWithPlacementID:%@ with extra: %@", placementID,extra);
}

- (void)bannerView:(ATBannerView*)bannerView didClickWithPlacementID:(NSString*)placementID extra:(NSDictionary *)extra{
    NSLog(@"ATBannerViewController::bannerView:didClickWithPlacementID:%@ with extra: %@", placementID,extra);
}

- (void)bannerView:(ATBannerView*)bannerView didAutoRefreshWithPlacement:(NSString*)placementID extra:(NSDictionary *)extra {
    NSLog(@"ATBannerViewController::bannerView:didAutoRefreshWithPlacement:%@ with extra: %@", placementID,extra);
}

- (void) bannerView:(ATBannerView *)bannerView failedToAutoRefreshWithPlacementID:(NSString *)placementID error:(NSError *)error {
    NSLog(@"ATBannerViewController::bannerView:failedToAutoRefreshWithPlacementID:%@ error:%@", placementID, error);
}

- (void)bannerView:(ATBannerView*)bannerView didTapCloseButtonWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra {
    NSLog(@"ATBannerViewController::bannerView:didTapCloseButtonWithPlacementID:%@ extra: %@", placementID,extra);

    // After receiving the Close button callback, you need to remove bannerView yourself
}

- (void)bannerView:(ATBannerView *)bannerView didDeepLinkOrJumpForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra result:(BOOL)success {
    NSLog(@"ATBannerViewController:: didDeepLinkOrJumpForPlacementID:placementID:%@ with extra: %@, success:%@", placementID,extra, success ? @"YES" : @"NO");
}

@end

Please refer to Demo's ATBannerViewController class

Last modified: 2025-05-30Powered by