iOS - Banner Ad
Compatible with Vpon SDK v4.9 and below
Compatible with Vpon SDK v4.9 and below
Vpon Banner can be embedded to part of your app layout. It consists of a multimedia object which can attract user. The ads will expand to show much richer content after clicking.
Please make sure you’ve imported Vpon SDK to your Xcode project. If not, please refer to our Integration Guide to finish your setting.
iOS apps are composed of UIView objects which will present as text area, buttons or other controllers. VpadnBanner is simply an UIView subclass that can display small HTML5 ads trigger by users’ touch.
Just like all the other UIView, a VpadnBanner is easy to implement in code.
VpadnSDKAdKit
We strongly recommend that you can finish all the steps in ViewController of the application.
#import <ViewController.h>
// import Vpon SDK
@import VpadnSDKAdKit;
// Add a protocol to receive the status of Ads
@interface ViewController() <VpadnBannerDelegate>
// Declare VpadnBanner Instance
@property (strong, nonatomic) VpadnBanner *vpadnBanner;
@property (weak, nonatomic) IBOutlet UIView *loadBannerView;
@end
Please refer to the code snippet below to initialize Banner Ad in viewDidLoad of ViewController.
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
if (self.vpadnBanner != nil) {
[self.vpadnBanner.getVpadnAdView removeFromSuperview];
}
vpadnBanner = [[VpadnBanner alloc] initWithAdSize:VpadnAdSizeBANNER]; // Initialize Banner Object
vpadnBanner.strBannerId = @""; // Fill in with your License Key
vpadnBanner.delegate = self; // Set up Delegate to receive protocol message
vpadnBanner.platform = @"TW"; // Fill in with "TW"
[vpadnBanner setAdAutoRefresh:YES]; // Set "YES" to enable Banner auto refresh. Set "NO" if you use mediation
[vpadnBanner setRootViewController:self];
[self.loadBannerView addSubview:bannerView]; // Add VpadnBanner View to ViewController
...
}
After finishing banner ad initialization, add the code snippet to request for ads:
- (void)viewDidLoad {
...
// Start to request Banner Ad
[vpadnBanner startGetAd:[]];
// Start to request test Banner Ad with below code snippet
// [vpadnBanner startGetAd:[self getTestIdentifiers]];
}
Please add the code snippet to your application and fill in with your test device’s UUID as below to request for test ads.
-(NSArray*)getTestIdentifiers {
return [NSArray arrayWithObjects:
// Add your test device's UUID
@"your_UUID",
nil];
}
After finishing ad request, implement the delegate protocol as below to listen ad status.
#pragma mark - Vpadn Banner Delegate
- (void)onVpadnAdReceived:(UIView *)bannerView{
NSLog(@"VpadnAdReceived");
}
- (void)onVpadnAdFailed:(UIView *)bannerView didFailToReceiveAdWithError:(NSError *)error{
NSLog(@"VpadnAdFailed");
}
- (void)onVpadnPresent:(UIView *)bannerView{
NSLog(@"VpadnPresent %@",bannerView);
}
- (void)onVpadnDismiss:(UIView *)bannerView{
NSLog(@"VpadnDismiss %@",bannerView);
}
- (void)onVpadnLeaveApplication:(UIView *)bannerView{
NSLog(@"Leave publisher application");
}
Besides the 320x50, Vpon supports the following ad formats:
Size (WxH) | Description | VponAdSize Constant | Devices |
---|---|---|---|
320x50 | Standard Banner | VpadnAdSizeBANNER | iPhone iPad |
468x60 | IAB Full-Size Banner | VpadnAdSizeFullBanner | iPad |
728x90 | IAB Leaderboard | VpadnAdSizeLeaderboard | iPad |
300x250 | IAB Medium Recangle | VpadnAdSizeMediumRectangle | iPhone iPad |
device width x auto height | Smart Banner Portrait | VpadnAdSizeSmartBannerPortrait | iPhone iPad |
device width x auto height | Smart Banner Landscape | VpadnAdSizeSmartBannerLandscape | iPhone iPad |
Apple recently revised App Transport Security (ATS), to iOS9. Please refer to iOS9 ATS for some modification.
Please refer to our Sample Code for a complete integration sample.
Please refer to the link below to learn more about other ad types: