Card Ad

Add Files for Card Ad Integration

Add CECardAD.h and CECardAD.m to your app's build target.

Request Card Ad Instantly

With loadAdInstant, our synchronous method, You will get the result of loading ad directly.

  • Import CECardAD.h

// MyViewController.m

#import "CECardAD.h"

@interface MyViewController()
  • Create a CECardAD instance and keep its reference. Load ad with your CECardAD instance.

@interface MyViewController() <CECardADDelegate>
@property (nonatomic, strong) CECardAD *cardAd;
@end

- (void) viewDidLoad()
{
    CERequestInfo *info = [CERequestInfo new];
    info.placement = @"PUT_YOUR_PLACEMENT_STRING_HERE·";
    self.cardAd = [[CECardAD alloc] initWithVideoViewProfile: CEVideoViewProfileCardDefaultProfile];
    NSError *error;
    if ([self.ceCardAD loadAdInstantWithInfo:info error:&error]) {
        // TODO: The logic of render ad.
        [self appendLog:@"Get instant ad succefully"];

    } else {
        if (error) {
            // TODO: The logic of load ad fail.
            NSString * log = [NSString stringWithFormat:@"didFailWithError : %@", error.debugDescription];
            [self appendLog:log];
        }
    }
}

Request Card Ad Asynchronously

loadAdAsyncWithInfo is an asynchronous method, you can set timeout via CERequestInfo, and get the result of ad request by CECardADRequestDelegate.

  • Import CECardAD.h and adopt CECardADRequestDelegate protocol in view controller's extension.

  • Create a CECardAD instance and keep its reference. Load ad with your CECardAD instance.

  • Implement CECardADRequestDelegate to handle ad loaded event.

Add CECardADEventDelegate to get the ad event callback.

If you want to trace the click, impression, progress event, please implement CECardADEventDelegate to handle it.

Please refer to CECardAd for more information in detail.

Last updated