Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Showing Interstitial Ads

Owain Moss edited this page May 3, 2016 · 31 revisions

AdColony interstitial ads are a video ad immediately followed by an endcard.

###Instructions### Once you've performed the required Xcode Project Setup, you can display an AdColony interstitial ad in your app in three easy steps:

  1. Create or sign into your AdColony account and retrieve the AdColony app ID and AdColony zone ID for your app. For help, see Setting Up Apps And Zones.
  2. Configure AdColony with your app ID and zone ID.
  3. Request an interstitial from AdColony.
  4. Show the ad.

=== ###Code Example - Configuring AdColony### Configure the AdColony SDK using the app and zone IDs you created in the control panel

#import <AdColony/AdColony.h>

@implementation AppDelegate
/* Class body ... */

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    /* Method body ... */

    [AdColony configureWithAppID:/* App ID */ 
                         zoneIDs:@[/* Zone ID */] 
                         options:nil
                      completion:^(NSArray<AdColonyZone*>* zones) {}
    ];

    return YES;
}

=== ###Code Example - Requesting an interstitial###

#import <AdColony/AdColony.h>

@implementation ViewController

/* Class body ... */
-(void)requestInterstitial {
    [AdColony requestInterstitialInZone:/* Zone ID */ options:nil
        success:^(AdColonyInterstitial* ad) {
            ad.open = ^{
                NSLog(@"SDKTESTAPP: Ad opened");
            };
            ad.close = ^{
                NSLog(@"SDKTESTAPP: Ad closed");
            };

            _ad = ad;
        }
        failure:^(AdColonyAdRequestError* error) {
            NSLog(@"Interstitial request failed with error: %@", [error localizedDescription]);
        }
     ];
}

=== ###Code Example - Showing the Interstitial### Using the AdColonyInterstitial object passed back via the success handler, trigger a fullscreen ad experience when appropriate:

#import <AdColony/AdColony.h>

@implementation ViewController

/* Class body ... */
-(void)showInterstitial {
    [_ad showWithPresentingViewController:self];
}
Clone this wiki locally