MANativeAdLoader.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // MANativeAdLoader.h
  3. // AppLovinSDK
  4. //
  5. // Created by Andrew Tian on 7/14/21.
  6. //
  7. #import <AppLovinSDK/MAAdRevenueDelegate.h>
  8. #import <AppLovinSDK/MAAdReviewDelegate.h>
  9. #import <AppLovinSDK/MANativeAdDelegate.h>
  10. @class ALSdk;
  11. @class MAAd;
  12. @class MANativeAdView;
  13. NS_ASSUME_NONNULL_BEGIN
  14. /**
  15. * This class represents a loader for native ads.
  16. */
  17. @interface MANativeAdLoader : NSObject
  18. /**
  19. * Creates a new MAX native ad loader.
  20. *
  21. * @param adUnitIdentifier Ad unit ID to load ads for.
  22. */
  23. - (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier;
  24. /**
  25. * Creates a new MAX native ad loader.
  26. *
  27. * @param adUnitIdentifier Ad unit ID to load ads for.
  28. * @param sdk SDK to use. You can obtain an instance of the SDK by calling @code +[ALSdk shared] @endcode.
  29. */
  30. - (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier sdk:(ALSdk *)sdk;
  31. - (instancetype)init NS_UNAVAILABLE;
  32. + (instancetype)new NS_UNAVAILABLE;
  33. /**
  34. * A delegate that will be notified about native ad events.
  35. */
  36. @property (nonatomic, weak, nullable) id<MANativeAdDelegate> nativeAdDelegate;
  37. /**
  38. * A delegate that will be notified about ad revenue events.
  39. */
  40. @property (nonatomic, weak, nullable) id<MAAdRevenueDelegate> revenueDelegate;
  41. /**
  42. * A delegate that will be notified about Ad Review events.
  43. */
  44. @property (nonatomic, weak, nullable) id<MAAdReviewDelegate> adReviewDelegate;
  45. /**
  46. * Load a new MAX native ad. Set @code -[MANativeAdLoader nativeAdDelegate] @endcode to assign a delegate that should be notified about ad load state.
  47. */
  48. - (void)loadAd;
  49. /**
  50. * Load a new MAX native ad into the given native ad view. Set @code -[MANativeAdLoader nativeAdDelegate] @endcode to assign a delegate that should be notified about ad load state.
  51. *
  52. * @param adView a @c MANativeAdView into which the loaded native ad will be rendered.
  53. */
  54. - (void)loadAdIntoAdView:(nullable MANativeAdView *)adView;
  55. /**
  56. * Renders the given ad into the given ad view.
  57. *
  58. * Note: Make sure to only render the ad separately if the native ad view returned in our @code -[MANativeAdDelegate didLoadNativeAd:forAd:] @endcode is @c nil.
  59. *
  60. * @param adView The ad view into which to render the native ad.
  61. * @param ad The ad to be rendered.
  62. *
  63. * @return @c YES if the ad view was rendered successfully.
  64. */
  65. - (BOOL)renderNativeAdView:(MANativeAdView *)adView withAd:(MAAd *)ad;
  66. /**
  67. * The placement name that you assign when you integrate each ad format, for granular reporting in ad events (e.g. "Rewarded_Store", "Rewarded_LevelEnd").
  68. */
  69. @property (nonatomic, copy, nullable) NSString *placement;
  70. /**
  71. * The ad unit identifier this @c MANativeAdLoader was initialized with and is loading ads for.
  72. */
  73. @property (nonatomic, copy, readonly) NSString *adUnitIdentifier;
  74. /**
  75. * Destroy the native ad and fully remove it from memory.
  76. */
  77. - (void)destroyAd:(MAAd *)nativeAd;
  78. /**
  79. * Sets an extra key/value parameter for the ad.
  80. *
  81. * @param key Parameter key.
  82. * @param value Parameter value.
  83. */
  84. - (void)setExtraParameterForKey:(NSString *)key value:(nullable NSString *)value;
  85. /**
  86. * Set a local extra parameter to pass to the adapter instances. Will not be available in the @code -[MAAdapter initializeWithParameters:withCompletionHandler:] @endcode method.
  87. *
  88. * @param key Parameter key. Must not be null.
  89. * @param value Parameter value. May be null.
  90. */
  91. - (void)setLocalExtraParameterForKey:(NSString *)key value:(nullable id)value;
  92. /**
  93. * The custom data to tie the showing ad to, for ILRD and rewarded postbacks via the @c {CUSTOM_DATA} macro. Maximum size is 8KB.
  94. */
  95. @property (nonatomic, copy, nullable) NSString *customData;
  96. @end
  97. NS_ASSUME_NONNULL_END