loadADWithPlacementID: method of ATAdManager to load the ad.// Import header file
#import
/// Set up Auto Load Interstitial ad
/// - Parameter placementID: Placement ID
- (void)loadInterstitialADWithPlacementID:(NSString *)placementID {
// Set delegate
[ATInterstitialAutoAdManager sharedInstance].delegate = self;
// Set LocalExtra custom parameters, which will be returned in the delegate's Extra and can be used for custom rule matching for this placement. Parameters can be referenced.
[[ATInterstitialAutoAdManager sharedInstance] setLocalExtra:@{} placementID:placementID];
// Start automatically loading ads
[[ATInterstitialAutoAdManager sharedInstance] addAutoLoadAdPlacementIDArray:@[placementID]];
}
If you need to display ads in the load success callback (didFinishLoadingADWithPlacementID:), to avoid the ad failing to display properly, please ensure that the current app is in an active state (UIApplicationState==UIApplicationStateActive).
/// Display ad
/// - Parameters:
/// - placementID: Placement ID
- (void)showInterstitialADWithPlacementID:(NSString *)placementID {
// Check if the ad is ready before displaying
BOOL isReady = [[ATInterstitialAutoAdManager sharedInstance] autoLoadInterstitialReadyForPlacementID:placementID];
if (isReady) {
[[ATInterstitialAutoAdManager sharedInstance] showAutoLoadInterstitialWithPlacementID:placementID inViewController:self delegate:self];
}
}
| Class Name / File Name | Introduction |
|---|---|
| ATAdManager | The base operation class for ads, including features such as ad loading, filtering ads, and scenario statistics. |
| ATInterstitialAutoAdManager | The management class for Auto Load Interstitial ads, providing features such as enabling Auto Load, removing Auto Load, setting local parameters, checking ready status, displaying ads, and scenario statistics. |
| ATAdLoadingDelegate | The base delegate callback declaration for ads, including placement-level and ad source-level load success or failure callbacks, as well as bidding completion and bidding failure callbacks for bidding ad sources. |
| ATInterstitialDelegate | Delegate callbacks specific to the Interstitial ad type, including display, click, dismiss, etc. |
| ATSDKGlobalSetting | A general settings class, providing features such as clearing ad memory caches, custom traffic group settings, test mode, setting third-party ad SDK related information, etc. It also declares some general properties. |