Load Ads
Creating Interstitial & Rewarded Ads
To show an ad, create a variable to hold a reference to either the Interstitial or Rewarded Mediation Ad:
@property (nonatomic) id<HeliumInterstialAd> interstitialAd;
@property (nonatomic) id<HeliumRewardedAd> rewardedAd;
Using the Placement Name you set up on your dashboard, get an instance of a Mediation Ad with the following:
self.interstitialAd = [[HeliumSdk sharedHelium] interstitialAdProviderWithDelegate:self andPlacementName:@"MYHELIUMPLACEMENT1"];
self.rewardedAd = [[HeliumSdk sharedHelium] rewardedAdProviderWithDelegate:self andPlacementName:@"MYHELIUMPLACEMENT2"];
Loading Interstitial & Rewarded Ads
To create an instance for each Placement Name you want to use, make the following call to load the ad:
[self.interstitialAd loadAd];
[self.rewardedAd loadAd];
You can implement CHBHeliumInterstitialAdDelegate
or CHBHeliumRewardedAdDelegate
in your class to receive notifications about the success or failure of the ad loading process. See iOS Delegate Usage for more details.
Creating Banner Ads
To show a banner ad, declare a variable to hold a reference to the Banner Mediation Adand supply the corresponding Placement Name and Banner Size.
@property (nonatomic) HeliumBannerView *bannerAd;
Banner Enum | Dimensions (Width x Height) |
---|---|
Standard | (320 x 50) |
Medium | (300 x 250) |
Leaderboard | (728 x 90) |
/*
The following Banner enum Sizes can be passed down:
CHBHBannerSize_Standard
CHBHBannerSize_Medium
CHBHBannerSize_Leaderboard
*/
/// Helium banner ad instance must be retained for the lifetime of the ad.
@property (nonatomic, strong) HeliumBannerView *bannerAd;
if (self.bannerAd == nil) {
CHBHBannerSize bannerSize = CHBHBannerSize_Standard;
self.bannerAd = [HeliumSdk.sharedHelium bannerProviderWithDelegate:self andPlacementName:@"MY_BANNER_PLACEMENT" andSize:bannerSize];
}
/*
The following Banner enum Sizes can be passed down:
CHBHBannerSize_Standard
CHBHBannerSize_Medium
CHBHBannerSize_Leaderboard
*/
if (self.bannerAd == nil) {
CHBHBannerSize bannerSize = CHBHBannerSize_Standard;
self.bannerAd = [[HeliumSdk sharedHelium] bannerProviderWithDelegate:self andPlacementName:@"MYBANNERPLACEMENT" andSize:bannerSize];
}
Loading Banner Ads
To create an instance for each Placement Name you want to use make the following call to load the ad:
if (self.bannerAd != nil) {
[self.bannerAd loadAdWithViewController:viewControllerForModalContent];
}
if (self.bannerAd)
[self.bannerAd loadAd];
Clearing Loaded Ads
Clearing loaded ads may be necessary on existing placements to request another ad (i.e. for an in-house programmatic auction).
Clearing Interstitial and Rewarded Ads
[self.interstitialAd clearAd];
[self.rewardedAd clearAd];
[self.interstitialAd clearLoadedAd];
[self.rewardedAd clearLoadedAd];
Clearing Banner Ads
This will clear the currently displayed ad and any cached ad loaded for auto refresh.
[self.bannerAd clearAd];
[self.bannerAd clearLoadedAd];
The 3.x clearAd
and 2.x clearLoadedAd
API returns a boolean and indicates if the ad object has been cleared and is ready for another load call.
Updated 4 days ago