Interactive Ads
Open an ad
Instantiate an CTInteractiveAd object that corresponds to your ad unit and call its openAd method
objc
#import <CartySDK/CartySDK.h>
self.interactiveAd = [[CTInteractiveAd alloc] init];
self.interactiveAd.placementid = @"<your-placement-id>";
self.interactiveAd.delegate = self;
[self.interactiveAd openAd:rootViewController];swift
import CartySDK
interactiveAd = CTInteractiveAd()
interactiveAd.placementid = "<your-placement-id>"
interactiveAd.delegate = self
interactiveAd.open(rootViewController)Register for Callbacks
Implement CTInteractiveAdDelegate to listen to ad events.
objc
- (void)CTInteractiveAdDidOpen:(nonnull CTInteractiveAd *)ad
{
NSLog(@"Ad open");
}
- (void)CTInteractiveAdOpenFail:(nonnull CTInteractiveAd *)ad withError:(nonnull NSError *)error
{
NSLog(@"Ad open fail: %@",error.localizedDescription);
}
- (void)CTInteractiveAdDidDismiss:(nonnull CTInteractiveAd *)ad
{
NSLog(@"Ad did close");
}swift
func ctInteractiveAdDidOpen(_ ad: CTInteractiveAd) {
print("Ad open")
}
func ctInteractiveAdOpenFail(_ ad: CTInteractiveAd, withError error: any Error) {
print("Ad open fail \(error.localizedDescription)")
}
func ctInteractiveAdDidDismiss(_ ad: CTInteractiveAd) {
print("Ad did close")
}