Copy @interface ViewController () <AATInfeedBannerPlacementDelegate, AATBannerRequestDelegate>
@property id<AATAsyncInfeedBannerPlacement> placement;
@end
@implementation ViewController
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// [IMPORTANT] Notify AATKit about the currently active view controller
[AATSDK controllerViewDidAppearWithController:self];
// Create the placement
AATBannerConfiguration *configuration = [[AATBannerConfiguration alloc] init];
return [AATSDK createAsyncInfeedBannerPlacement:@"<PLACEMENT_NAME>" configuration:configuration];
// Set placement delegate to listen to the callbacks
self.placement.delegate = self;
// Create the banner request instance
AATBannerRequest *request = [[AATBannerRequest alloc] initWithDelegate:self];
// Configure request banner sizes
NSSet *sizes = [[NSSet alloc] initWithArray:@[@(AATBannerSizeBanner320x53), @(AATBannerSizeBanner300x250), @(AATBannerSizeBanner320x100)]];
[request setRequestBannerSizes: sizes];
// Configure request targeting information
request.targetingInformation = @{@"Key": @[@"value"]};
// Configure request content targeting URL
request.contentTargetingUrl = @"http://example.com/similar/content";
// Perform the request
[self.placement requestAdWithRequest: request
completion:^(AATBannerPlacementWrapperView * _Nullable bannerView, AATBannerRequestError * _Nullable error) {
if (error) {
// Handle Error
return;
}
// Handle banner display
}];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
// [IMPORTANT] Remove the currently active view controller
[AATSDK controllerViewWillDisappear];
}
#pragma mark - AATInfeedBannerPlacementDelegate
- (void)aatPauseForAdWithPlacement:(id<AATPlacement> _Nonnull)placement {
// Ad has been displayed on the screen
}
- (void)aatResumeAfterAdWithPlacement:(id<AATPlacement>)placement {
// Back to the app after clicking on the ad
}
#pragma mark - AATBannerRequestDelegate
- (BOOL)shouldUseTargetingFor:(AATBannerRequest * _Nonnull)request network:(enum AATAdNetwork)network {
return YES;
}
@end