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

Showing Interstitial Ads

Owain Moss edited this page Apr 28, 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. Insert code that runs on app launch to configure AdColony with your app ID and zone ID.
  3. Insert code to request an interstitial from AdColony.
  4. Show the ad.

=== ####Configuring AdColony#### After calling configure, create an AdColonyInterstitialListener:

#import <AdColony/AdColony.h>

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

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

    [AdColony configureWithAppID:kHookedOnWordsAppID 
                         zoneIDs:@[kHookedOnWordsZoneID] 
                         options:nil
                      completion:^(NSArray<AdColonyZone*>* zones) {}
    ];

    return YES;
}

Next, request an interstitial:

    [AdColony requestInterstitialInZone:kHookedOnWordsZoneID options:nil
        success:^(AdColonyInterstitial* ad) {
            ad.open = ^{
                NSLog(@"SDKTESTAPP: Ad opened");
            };
            ad.close = ^{
                NSLog(@"SDKTESTAPP: Ad closed");
            };
        }
        failure:^(AdColonyAdRequestError* error) {
            NSLog(@"Request failed with error: %@", [error localizedDescription]);
        }
     ];

=== ####Step 3: Show the Interstitial Ad#### Using the AdColonyInterstitial object passed back via the success handler, trigger a fullscreen ad experience when appropriate:

[ad showWithPresentingViewController:self];
Clone this wiki locally