Menu

ATAdManager (Native)

The operation extension for Native ads, providing features such as ad display, checking cache, checking whether the ad is ready, and scenario statistics. It also includes the definition of Extra keys.

Copy
// Native ad asset key definitions
extern NSString *const kATNativeADAssetsAdvertiserKey;  // Advertiser
extern NSString *const kATNativeADAssetsMainTextKey;    // Ad description
extern NSString *const kATNativeADAssetsMainTitleKey;   // Ad title
extern NSString *const kATNativeADAssetsMainImageKey;   // Main image
extern NSString *const kATNativeADAssetsIconImageKey;   // Icon
extern NSString *const kATNativeADAssetsLogoImageKey;   // Logo image
extern NSString *const kATNativeADAssetsCTATextKey;     // Call-to-action copy
extern NSString *const kATNativeADAssetsRatingKey;      // Rating
extern NSString *const kATNativeADAssetsContainsVideoFlag;  // Whether it contains a video
extern NSString *const kATNativeADAssetsUnitIDKey;      // Ad unit ID
extern NSString *const kATNativeADAssetsIconURLKey;     // Icon URL
extern NSString *const kATNativeADAssetsImageURLKey;    // Image URL
extern NSString *const kATNativeADAssetsLogoURLKey;     // Logo URL
extern NSString *const kATNativeADAssetsVideoUrlKey;    // Video URL
extern NSString *const kATAdAssetsCustomObjectKey;      // Custom object
extern NSString *const kATNativeADAssetsMediaViewKey;   // Media view
extern NSString *const kATNativeADAssetsImageListKey;   // Image list
extern NSString *const kATNativeADAssetsVideoDurationKey;  // Video duration
extern NSString *const kATNativeADAssetsVideoAspectRatioKey;  // Video aspect ratio
extern NSString *const kATNativeADAssetsNativeExpressAdViewWidthKey;   // Template ad view width
extern NSString *const kATNativeADAssetsNativeExpressAdViewHeightKey;  // Template ad view height
extern NSString *const kATNativeADAssetsInteractionTypeKey;   // Interaction type
extern NSString *const kATNativeADAssetsVideoMutedTypeKey;    // Video mute type
extern NSString *const kATNativeADAssetsMainImageWidthKey;    // Main image width
extern NSString *const kATNativeADAssetsMainImageHeightKey;   // Main image height
extern NSString *const kATNativeADAssetsMediaExtKey;          // Media extension
extern NSString *const kATNativeADAssetsSourceKey;            // Ad source
extern NSString *const kATNativeADAssetsCommentNumKey;        // Number of comments
extern NSString *const kATNativeADAssetsAppSizeKey;           // App size
extern NSString *const kATNativeADAssetsAppPriceKey;          // App price
extern NSString *const kATNativeADAssetsDomainKey;            // Domain
extern NSString *const kATNativeADAssetsWarningKey;           // Warning info
extern NSString *const kATNativeADAssetsIsExpressAdKey;       // Whether it is a template ad

// Currently, only GDT supports the following two keys
extern NSString *const kATExtraInfoNativeAdSizeKey;  // The value must be a CGSize object wrapped in an NSValue
extern NSString *const kATExtraInfoNativeAdTypeKey;   // Required value for GDT native ads. Must be an NSNumber wrapping ATGDTNativeAdType (NSInteger). For template ads, pass @(ATGDTNativeAdTypeTemplate) (@1). For self-rendering ads, pass @(ATGDTNativeAdTypeSelfRendering) (@2).

// The following keys are only supported by Nend  TODO_Optimize into the Nend Adapter
extern NSString *const kATExtraInfoNativeAdUserIDKey;
extern NSString *const kATExtraInfoNativeAdMediationNameKey;
extern NSString *const kATExtraInfoNaitveAdUserFeatureKey;
extern NSString *const kATExtraInfoNativeAdLocationEnabledFlagKey;

extern NSString *const kATNativeAdSizeToFitKey;

// GDT native ad type enum
typedef NS_ENUM(NSInteger, ATGDTNativeAdType) {
    ATGDTNativeAdTypeTemplate = 1,        // Template ad
    ATGDTNativeAdTypeSelfRendering = 2    // Self-rendering ad
};

@class ATNativeADView;
@class ATNativeADConfiguration;
@class ATNativeAdOffer;

// Baidu template rendering attribute delegate protocol
@protocol ATBaiduTemplateRenderingAttributeDelegate <NSObject>

@optional
// Logo configuration properties
@property (nonatomic, strong) NSString *iconWidth;      // Icon width
@property (nonatomic, strong) NSString *iconHeight;     // Icon height
@property (nonatomic, strong) NSString *iconLeft;       // Icon left margin
@property (nonatomic, strong) NSString *iconTop;        // Icon top margin
@property (nonatomic, strong) NSString *iconRight;      // Icon right margin
@property (nonatomic, strong) NSString *iconBottom;     // Icon bottom margin

// Title configuration properties
[... The remaining property configuration items are kept as-is because they are all self-describing ...]

@end

@interface ATAdManager (Native)

/// Get native ad assets
- (nullable ATNativeAdOffer *)getNativeAdOfferWithPlacementID:(NSString *)placementID;

/// Get native ad assets
/// @param placementID - TopOn placement ID
/// @param scene - Scenario ID
- (nullable ATNativeAdOffer *)getNativeAdOfferWithPlacementID:(NSString *)placementID
                                               scene:(NSString *)scene;

- (nullable ATNativeAdOffer *)getNativeAdOfferWithPlacementID:(NSString *)placementID
                                          showConfig:(ATShowConfig *)showConfig;

/// Check whether the native ad is ready
- (BOOL)nativeAdReadyForPlacementID:(NSString *)placementID;

/// Get the status object ATCheckLoadModel of the current placement
/// v5.7.06+
- (ATCheckLoadModel *)checkNativeLoadStatusForPlacementID:(NSString *)placementID;

/// Query all cache information for the placement
/// v5.7.53+
- (nullable NSArray<NSDictionary *> *)getNativeValidAdsForPlacementID:(NSString *)placementID;

/// Set the Baidu template rendering attribute
- (void)setBaiduTemplateRenderingAttribute:(id<ATBaiduTemplateRenderingAttributeDelegate>)baiduTemplateRenderingAttribute;

/// Record the cache status statistics of the current placement in a business scenario
/// @param scene - Ad scenario
/// v5.7.91+
- (void)entryNativeScenarioWithPlacementID:(NSString *)placementID
                                     scene:(NSString *)scene;

@end
Previous
ATAdManager (Interstitial)
Next
ATAdManager (RewardedVideo)
Last modified: 2026-07-08Powered by