ATAdManager's loadADWithPlacementID: method for ad loading.// Import header file
#import <AnyThinkInterstitial/AnyThinkInterstitial.h>
/// Set auto-load Interstitial ad
/// - Parameter placementID: Ad Placement ID
- (void)loadInterstitialADWithPlacementID:(NSString *)placementID {
// Set delegate
[ATInterstitialAutoAdManager sharedInstance].delegate = self;
// Set LocalExtra custom parameters that will be passed back in the delegate's Extra. Can be used for custom rule matching for this ad placement. See parameters for reference.
[[ATInterstitialAutoAdManager sharedInstance] setLocalExtra:@{} placementID:placementID];
// Start auto-loading ads
[[ATInterstitialAutoAdManager sharedInstance] addAutoLoadAdPlacementIDArray:@[placementID]];
}
If you need to display the ad in the load success callback (didFinishLoadingADWithPlacementID:), to avoid the ad not being displayed properly, please ensure that the current app is in the active state (UIApplicationState==UIApplicationStateActive).
/// Display Ad
/// - Parameters:
/// - placementID: Ad Placement ID
- (void)showInterstitialADWithPlacementID:(NSString *)placementID {
// Before displaying, check whether the ad is ready
BOOL isReady = [[ATInterstitialAutoAdManager sharedInstance] autoLoadInterstitialReadyForPlacementID:placementID];
if (isReady) {
[[ATInterstitialAutoAdManager sharedInstance] showAutoLoadInterstitialWithPlacementID:placementID inViewController:self delegate:self];
}
}
| Class Name / File Name | Introduction |
|---|---|
| ATAdManager | The base ad operation class, including ad loading, filtering ads, scenario statistics, and other features. |
| ATInterstitialAutoAdManager | The auto-load Interstitial ad management class, providing features for enabling auto load, removing auto load, setting local parameters, checking readiness status, displaying ads, and scenario statistics. |
| ATAdLoadingDelegate | The base delegate callback declaration for ads, including ad placement-level and Ad Source-level load success or failure callbacks, and bid completion and bid failure callbacks for bidding Ad Sources. |
| ATInterstitialDelegate | Delegate callbacks for the Interstitial ad type, including impression, click, and close, etc. |
| ATSDKGlobalSetting | General settings class, providing features such as clearing in-memory ad caches, custom traffic group settings, test mode, configuring third-party ad SDK information, etc. It also declares some common properties. |