ALSdk.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. //
  2. // ALSdk.h
  3. // AppLovinSDK
  4. //
  5. // Created by Basil Shikin on 2/1/12.
  6. // Copyright © 2020 AppLovin Corporation. All rights reserved.
  7. //
  8. @class ALAdService;
  9. @class ALCMPService;
  10. @class ALEventService;
  11. @class ALSdkConfiguration;
  12. @class ALSdkInitializationConfiguration;
  13. @class ALSdkSettings;
  14. @class ALTargetingData;
  15. @class ALUserSegment;
  16. @class MAMediatedNetworkInfo;
  17. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * This is a base class for the AppLovin iOS SDK.
  20. */
  21. @interface ALSdk : NSObject
  22. #pragma mark - High Level SDK Properties
  23. /**
  24. * The current version of the SDK. The value is in the format of "<var>Major</var>.<var>Minor</var>.<var>Revision</var>".
  25. */
  26. @property (class, nonatomic, copy, readonly) NSString *version;
  27. /**
  28. * The current version of the SDK in numeric format.
  29. */
  30. @property (class, nonatomic, assign, readonly) NSUInteger versionCode;
  31. /**
  32. * This SDK’s SDK key.
  33. */
  34. @property (nonatomic, copy, readonly) NSString *sdkKey;
  35. /**
  36. * This SDK’s SDK settings.
  37. */
  38. @property (nonatomic, strong, readonly) ALSdkSettings *settings;
  39. /**
  40. * The SDK configuration object that the SDK creates when you initialize the SDK.
  41. */
  42. @property (nonatomic, strong, readonly) ALSdkConfiguration *configuration;
  43. /**
  44. * @deprecated This property has been moved to @c ALSdkSettings and will be removed in a future SDK version.
  45. */
  46. @property (nonatomic, copy, nullable) NSString *userIdentifier __deprecated_msg("This property has been moved to @c ALSdkSettings and will be removed in a future SDK version.");
  47. /**
  48. * A user segment allows AppLovin to serve ads by using custom-defined rules that are based on which segment the user is in. The user segment is a custom string of 32 alphanumeric characters or less.
  49. */
  50. @property (nonatomic, strong, readonly, nullable) ALUserSegment *userSegment;
  51. /**
  52. * A class which allows you to send any demographic or interest-based targeting data.
  53. */
  54. @property (nonatomic, strong, readonly, nullable) ALTargetingData *targetingData;
  55. #pragma mark - SDK Services
  56. /**
  57. * The ad service, which loads and displays ads from AppLovin servers.
  58. */
  59. @property (nonatomic, strong, readonly) ALAdService *adService;
  60. /**
  61. * The AppLovin event service, which tracks post-install user events.
  62. *
  63. * @return Event service. Guaranteed not to be @c NULL.
  64. */
  65. @property (nonatomic, strong, readonly) ALEventService *eventService;
  66. /**
  67. * The CMP service, which provides direct APIs for interfacing with the Google-certified CMP installed, if any.
  68. *
  69. * @return CMP service. Guaranteed not to be @c NULL.
  70. */
  71. @property (nonatomic, strong, readonly) ALCMPService *cmpService;
  72. #pragma mark - MAX
  73. /**
  74. * The mediation provider. Set this either by using one of the provided strings in ALMediationProvider.h, or your own string if you do not find an applicable one there.
  75. *
  76. * @deprecated This property has been moved to @c ALSdkInitializationConfiguration and will be removed in a future SDK version.
  77. */
  78. @property (nonatomic, copy, nullable) NSString *mediationProvider __deprecated_msg("This setter has been moved to @c ALSdkInitializationConfiguration and will be removed in a future SDK version.");
  79. /**
  80. * The list of available mediation networks, as an array of @c MAMediatedNetworkInfo objects.
  81. */
  82. @property (nonatomic, strong, readonly) NSArray<MAMediatedNetworkInfo *> *availableMediatedNetworks;
  83. /**
  84. * Present the mediation debugger UI.
  85. * This debugger tool provides the status of your integration for each third-party ad network.
  86. *
  87. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/testing-networks/mediation-debugger">MAX Integration Guide ⇒ iOS ⇒ Testing Networks ⇒ Mediation Debugger</a>
  88. */
  89. - (void)showMediationDebugger;
  90. /**
  91. * Present the mediation debugger UI.
  92. * This debugger tool provides the status of your integration for each third-party ad network.
  93. *
  94. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/testing-networks/mediation-debugger">MAX Integration Guide ⇒ iOS ⇒ Testing Networks ⇒ Mediation Debugger</a>
  95. *
  96. * @param amazonAdSizes A map of the MAX Ad Unit ID to Amazon Publisher Services' @c DTBAdSize.
  97. */
  98. - (void)showMediationDebuggerWithAmazonAdSize:(nullable NSDictionary<NSString *, NSArray/*DTBAdSize*/ *> *)amazonAdSizes;
  99. /**
  100. * Present the Creative Debugger UI.
  101. * This debugger tool provides information for recently displayed ads.
  102. */
  103. - (void)showCreativeDebugger;
  104. #pragma mark - SDK Initialization
  105. /**
  106. * The sort of callback that the SDK calls when it finishes initializing.
  107. */
  108. typedef void (^ALSdkInitializationCompletionHandler)(ALSdkConfiguration *configuration);
  109. /**
  110. * Whether the SDK has fully been initialized without errors and the completion callback called.
  111. */
  112. @property (nonatomic, assign, readonly, getter=isInitialized) BOOL initialized;
  113. /**
  114. * Gets a shared instance of AppLovin SDK.
  115. *
  116. * @return The shared instance of AppLovin’s SDK, or @c nil (indicating an error) if the SDK key is not set in the application’s @code Info.plist @endcode.
  117. */
  118. + (ALSdk *)shared;
  119. /**
  120. * Initializes the SDK with the given initialization configuration and completion block.
  121. *
  122. * The SDK invokes the callback on the main thread.
  123. *
  124. * @param initializationConfiguration The configuration to initialize the SDK with.
  125. * @param completionHandler The callback that the SDK will call when the SDK finishes initializing.
  126. *
  127. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/integration#initialize-the-sdk">MAX Integration Guide ⇒ iOS ⇒ Integration ⇒ Initialize the SDK</a>
  128. */
  129. - (void)initializeWithConfiguration:(ALSdkInitializationConfiguration *)initializationConfiguration completionHandler:(nullable ALSdkInitializationCompletionHandler)completionHandler;
  130. - (instancetype)init __attribute__((unavailable("Use +[ALSdk shared].")));
  131. + (instancetype)new NS_UNAVAILABLE;
  132. @end
  133. @interface ALSdk (Deprecated)
  134. - (void)setPluginVersion:(NSString *)pluginVersion __deprecated_msg("This method is deprecated and will be removed in a future SDK version. (see ALSdkInitializationConfiguration.pluginVersion)");
  135. /**
  136. * Initializes the SDK.
  137. */
  138. - (void)initializeSdk __deprecated_msg("This method is deprecated and will be removed in a future SDK version. Please use `-[[ALSdk shared] initializeWithConfiguration:completionHandler:]` instead.");
  139. /**
  140. * Initializes the SDK with a given completion block.
  141. *
  142. * The SDK invokes the callback on the main thread.
  143. *
  144. * @param completionHandler The callback that the SDK will call when the SDK finishes initializing.
  145. *
  146. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/integration#initialize-the-sdk">MAX Integration Guide ⇒ iOS ⇒ Integration ⇒ Initialize the SDK</a>
  147. */
  148. - (void)initializeSdkWithCompletionHandler:(nullable ALSdkInitializationCompletionHandler)completionHandler __deprecated_msg("This method is deprecated and will be removed in a future SDK version. Please use `-[[ALSdk shared] initializeWithConfiguration:completionHandler:]` instead.");
  149. /**
  150. * Initializes the default instance of AppLovin SDK.
  151. *
  152. * @warning Make sure your SDK key is set in the application’s @code Info.plist @endcode under the property @c AppLovinSdkKey.
  153. *
  154. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/integration#initialize-the-sdk">MAX Integration Guide ⇒ iOS ⇒ Integration ⇒ Initialize the SDK</a>
  155. */
  156. + (void)initializeSdk __deprecated_msg("This method is deprecated and will be removed in a future SDK version. Please use `-[[ALSdk shared] initializeWithConfiguration:completionHandler:]` instead.");
  157. /**
  158. * Initializes the default instance of AppLovin SDK.
  159. *
  160. * @warning Make sure your SDK key is set in the application’s @code Info.plist @endcode under the property @c AppLovinSdkKey.
  161. *
  162. * @param completionHandler The callback that the SDK will run on the main queue when the SDK finishes initializing.
  163. *
  164. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/integration#initialize-the-sdk">MAX Integration Guide ⇒ iOS ⇒ Integration ⇒ Initialize the SDK</a>
  165. */
  166. + (void)initializeSdkWithCompletionHandler:(nullable ALSdkInitializationCompletionHandler)completionHandler __deprecated_msg("This method is deprecated and will be removed in a future SDK version. Please use `-[[ALSdk shared] initializeWithConfiguration:completionHandler:]` instead.");
  167. /**
  168. * Gets a shared instance of AppLovin SDK.
  169. *
  170. * @warning Make sure your SDK key is set in the application’s @code Info.plist @endcode under the property @c AppLovinSdkKey.
  171. *
  172. * @param settings An SDK settings object.
  173. *
  174. * @return The shared instance of AppLovin’s SDK, or @c nil (indicating an error) if the SDK key is not set in the application’s @code Info.plist @endcode.
  175. */
  176. + (nullable ALSdk *)sharedWithSettings:(ALSdkSettings *)settings __deprecated_msg("This method is deprecated and will be removed in a future SDK version. Please use `+[ALSdk shared]` and initialize with `-[[ALSdk shared] initializeWithConfiguration:completionHandler:]` as soon as possible");
  177. /**
  178. * Gets an instance of AppLovin SDK by using an SDK key.
  179. *
  180. * @param key SDK key to use for the instance of the AppLovin SDK.
  181. *
  182. * @return An instance of AppLovin’s SDK, or @c nil (indicating an error) if @c key is not set.
  183. */
  184. + (nullable ALSdk *)sharedWithKey:(NSString *)key __deprecated_msg("This method is deprecated and will be removed in a future SDK version. Please use `+[ALSdk shared]` and initialize with `-[[ALSdk shared] initializeWithConfiguration:completionHandler:]` as soon as possible");
  185. /**
  186. * Gets an instance of AppLovin SDK by using an SDK key and providing SDK settings.
  187. *
  188. * @param key SDK key to use for the instance of the AppLovin SDK.
  189. * @param settings An SDK settings object.
  190. *
  191. * @return An instance of AppLovin’s SDK, or @c nil (indicating an error) if @c key is not set.
  192. */
  193. + (nullable ALSdk *)sharedWithKey:(NSString *)key settings:(ALSdkSettings *)settings __deprecated_msg("This method is deprecated and will be removed in a future SDK version. Please use `+[ALSdk shared]` and initialize with `-[[ALSdk shared] initializeWithConfiguration:completionHandler:]` as soon as possible");
  194. @end
  195. NS_ASSUME_NONNULL_END