Documentation Index
Fetch the complete documentation index at: https://docs.cloudx.io/llms.txt
Use this file to discover all available pages before exploring further.
Banner and MREC placements support standard network display ads, CloudX-rendered HTML creatives with MRAID 3.0 support, and native creatives served into banner/MREC slots when configured server-side. Native-in-banner and native-in-MREC demand is supported for Meta, Vungle, and Moloco without app-side API changes.
Banner Ads (320x50)
@interface YourViewController () <CLXBannerDelegate, CLXAdRevenueDelegate>
@property (nonatomic, strong) CLXBannerAdView *bannerAd;
@end
@implementation YourViewController
- (void)createBannerAd {
self.bannerAd = [[CloudXCore shared] createBannerWithAdUnitId:@"your-banner-ad-unit-id"];
self.bannerAd.delegate = self;
self.bannerAd.revenueDelegate = self;
if (self.bannerAd) {
self.bannerAd.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.bannerAd];
[NSLayoutConstraint activateConstraints:@[
[self.bannerAd.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor],
[self.bannerAd.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
[self.bannerAd.widthAnchor constraintEqualToConstant:320],
[self.bannerAd.heightAnchor constraintEqualToConstant:50]
]];
[self.bannerAd load];
}
}
- (void)dealloc {
[self.bannerAd destroy];
}
#pragma mark - CLXBannerDelegate
- (void)didLoadAd:(CLXAd *)ad {
NSLog(@"Banner ad loaded from %@", ad.networkName);
}
- (void)didFailToLoadAd:(NSString *)adUnitId error:(CLXError *)error {
NSLog(@"Banner ad failed to load: %@", error.localizedDescription);
}
- (void)didClickAd:(CLXAd *)ad {
NSLog(@"Banner ad clicked");
}
// Optional: Called when banner expands (e.g., MRAID)
- (void)didExpandAd:(CLXAd *)ad {
NSLog(@"Banner ad expanded");
}
// Optional: Called when banner collapses
- (void)didCollapseAd:(CLXAd *)ad {
NSLog(@"Banner ad collapsed");
}
#pragma mark - CLXAdRevenueDelegate
- (void)didPayRevenueForAd:(CLXAd *)ad {
NSLog(@"Banner revenue: %@ from %@", ad.revenue, ad.networkName);
}
@end
Banner ads auto-refresh by default. To control refresh manually:
[self.bannerAd stopAutoRefresh]; // Stop auto-refresh
[self.bannerAd load]; // Manually load a new ad
[self.bannerAd startAutoRefresh]; // Re-enable auto-refresh
Optional placement and custom data for tracking:
self.bannerAd.placement = @"home_screen";
self.bannerAd.customData = @"level:5,coins:100";
MREC Ads (300x250)
@interface YourViewController () <CLXBannerDelegate, CLXAdRevenueDelegate>
@property (nonatomic, strong) CLXBannerAdView *mrecAd;
@end
@implementation YourViewController
- (void)createMRECAd {
self.mrecAd = [[CloudXCore shared] createMRECWithAdUnitId:@"your-mrec-ad-unit-id"];
self.mrecAd.delegate = self;
self.mrecAd.revenueDelegate = self;
if (self.mrecAd) {
self.mrecAd.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.mrecAd];
[NSLayoutConstraint activateConstraints:@[
[self.mrecAd.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
[self.mrecAd.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor constant:-20],
[self.mrecAd.widthAnchor constraintEqualToConstant:300],
[self.mrecAd.heightAnchor constraintEqualToConstant:250]
]];
[self.mrecAd load];
}
}
- (void)dealloc {
[self.mrecAd destroy];
}
#pragma mark - CLXBannerDelegate
- (void)didLoadAd:(CLXAd *)ad {
NSLog(@"MREC ad loaded from %@", ad.networkName);
}
- (void)didFailToLoadAd:(NSString *)adUnitId error:(CLXError *)error {
NSLog(@"MREC ad failed to load: %@", error.localizedDescription);
}
- (void)didClickAd:(CLXAd *)ad {
NSLog(@"MREC ad clicked");
}
// Optional: Called when MREC expands (e.g., MRAID)
- (void)didExpandAd:(CLXAd *)ad {
NSLog(@"MREC ad expanded");
}
// Optional: Called when MREC collapses
- (void)didCollapseAd:(CLXAd *)ad {
NSLog(@"MREC ad collapsed");
}
#pragma mark - CLXAdRevenueDelegate
- (void)didPayRevenueForAd:(CLXAd *)ad {
NSLog(@"MREC revenue: %@ from %@", ad.revenue, ad.networkName);
}
@end
MREC ads also auto-refresh by default. Use the same refresh control methods as Banner ads.