Operation extensions for Native Ads, providing ad display, cache checking, readiness checking, scenario statistics, and other features, including the definition of Extra keys.
// 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 text
extern NSString *const kATNativeADAssetsRatingKey; // Rating
extern NSString *const kATNativeADAssetsContainsVideoFlag; // Whether it contains 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; // Comment count
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; // Value must be a CGSize object wrapped in NSValue
extern NSString *const kATExtraInfoNativeAdTypeKey; // Required value for GDT Native Ads, must be ATGDTNativeAdType(NSInteger) wrapped in NSNumber; pass @(ATGDTNativeAdTypeTemplate)(@1) for template ads, @(ATGDTNativeAdTypeSelfRendering)(@2) for self-rendering ads
// The following keys are only supported by Nend // TODO_To be optimized into 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 enumeration
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
[... Other property configuration items remain unchanged since they are all self-describing ...]
@end
@interface ATAdManager (Native)
/// Get native ad creative
- (nullable ATNativeAdOffer *)getNativeAdOfferWithPlacementID:(NSString *)placementID;
/// Get native ad creative
/// @param placementID - Taku Ad 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 for the current Ad Placement
/// v5.7.06+
- (ATCheckLoadModel *)checkNativeLoadStatusForPlacementID:(NSString *)placementID;
/// Query all cached information for the Ad Placement
/// v5.7.53+
- (nullable NSArray<NSDictionary *> *)getNativeValidAdsForPlacementID:(NSString *)placementID;
/// Set Baidu template rendering attributes
- (void)setBaiduTemplateRenderingAttribute:(id<ATBaiduTemplateRenderingAttributeDelegate>)baiduTemplateRenderingAttribute;
/// Record the cache status statistics of the current Ad Placement in the business scenario
/// @param scene - Ad Scenario
/// v5.7.91+
- (void)entryNativeScenarioWithPlacementID:(NSString *)placementID
scene:(NSString *)scene;
@end