No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UnityAdvertisement.h 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #import <UIKit/UIKit.h>
  2. #import <UnityAds/UnityServices.h>
  3. #import <UnityAds/UnityAdsInitializationDelegate.h>
  4. #import <UnityAds/UnityAdsLoadDelegate.h>
  5. #import <UnityAds/UnityAdsShowDelegate.h>
  6. #import <UnityAds/UADSLoadOptions.h>
  7. #import <UnityAds/UADSShowOptions.h>
  8. NS_ASSUME_NONNULL_BEGIN
  9. /**
  10. * `UnityAds` is a static class with methods for preparing and showing ads.
  11. */
  12. @interface UnityAds : NSObject
  13. - (instancetype)init NS_UNAVAILABLE;
  14. + (instancetype)initialize NS_UNAVAILABLE;
  15. /**
  16. * Initializes UnityAds. UnityAds should be initialized when app starts.
  17. *
  18. * @param gameId Unique identifier for a game, given by Unity Ads admin tools or Unity editor.
  19. */
  20. + (void)initialize: (NSString *)gameId;
  21. /**
  22. * Initializes UnityAds. UnityAds should be initialized when app starts.
  23. *
  24. * @param gameId Unique identifier for a game, given by Unity Ads admin tools or Unity editor.
  25. * @param initializationDelegate delegate for UnityAdsInitialization
  26. */
  27. + (void) initialize: (NSString *)gameId
  28. initializationDelegate: (nullable id<UnityAdsInitializationDelegate>)initializationDelegate;
  29. /**
  30. * Initializes UnityAds. UnityAds should be initialized when app starts.
  31. *
  32. * @param gameId Unique identifier for a game, given by Unity Ads admin tools or Unity editor.
  33. * @param testMode Set this flag to `YES` to indicate test mode and show only test ads.
  34. */
  35. + (void)initialize: (NSString *)gameId
  36. testMode: (BOOL)testMode;
  37. /**
  38. * Initializes UnityAds. UnityAds should be initialized when app starts.
  39. *
  40. * @param gameId Unique identifier for a game, given by Unity Ads admin tools or Unity editor.
  41. * @param testMode Set this flag to `YES` to indicate test mode and show only test ads.
  42. * @param initializationDelegate delegate for UnityAdsInitialization
  43. */
  44. + (void) initialize: (NSString *)gameId
  45. testMode: (BOOL)testMode
  46. initializationDelegate: (nullable id<UnityAdsInitializationDelegate>)initializationDelegate;
  47. /**
  48. * Load a placement to make it available to show. Ads generally take a few seconds to finish loading before they can be shown.
  49. * Note: The `load` API is in closed beta and available upon invite only. If you would like to be considered for the beta, please contact Unity Ads Support.
  50. *
  51. * @param placementId The placement ID, as defined in Unity Ads admin tools.
  52. */
  53. + (void)load: (NSString *)placementId;
  54. /**
  55. * Load a placement to make it available to show. Ads generally take a few seconds to finish loading before they can be shown.
  56. *
  57. * @param placementId The placement ID, as defined in Unity Ads admin tools.
  58. * @param loadDelegate The load delegate.
  59. */
  60. + (void) load: (NSString *)placementId
  61. loadDelegate: (nullable id<UnityAdsLoadDelegate>)loadDelegate;
  62. /**
  63. * Load a placement to make it available to show. Ads generally take a few seconds to finish loading before they can be shown.
  64. *
  65. * @param placementId The placement ID, as defined in Unity Ads admin tools.
  66. * @param options The load options.
  67. * @param loadDelegate The load delegate.
  68. */
  69. + (void) load: (NSString *)placementId
  70. options: (UADSLoadOptions *)options
  71. loadDelegate: (nullable id<UnityAdsLoadDelegate>)loadDelegate;
  72. /**
  73. * Show an ad using the provided placement ID.
  74. *
  75. * @param viewController The `UIViewController` that is to present the ad view controller.
  76. * @param placementId The placement ID, as defined in Unity Ads admin tools.
  77. * @param showDelegate The show delegate.
  78. */
  79. + (void) show: (UIViewController *)viewController
  80. placementId: (NSString *)placementId
  81. showDelegate: (nullable id<UnityAdsShowDelegate>)showDelegate;
  82. /**
  83. * Show an ad using the provided placement ID.
  84. *
  85. * @param viewController The `UIViewController` that is to present the ad view controller.
  86. * @param placementId The placement ID, as defined in Unity Ads admin tools.
  87. * @param options Additional options
  88. * @param showDelegate The show delegate.
  89. */
  90. + (void) show: (UIViewController *)viewController
  91. placementId: (NSString *)placementId
  92. options: (UADSShowOptions *)options
  93. showDelegate: (nullable id<UnityAdsShowDelegate>)showDelegate;
  94. + (BOOL) getDebugMode;
  95. /**
  96. * Set the logging verbosity of `UnityAds`. Debug mode indicates verbose logging.
  97. * @warning Does not relate to test mode for ad content.
  98. * @param enableDebugMode `YES` for verbose logging.
  99. */
  100. + (void)setDebugMode: (BOOL)enableDebugMode;
  101. /**
  102. * Check to see if the current device supports using Unity Ads.
  103. *
  104. * @return If `NO`, the current device cannot initialize `UnityAds` or show ads.
  105. */
  106. + (BOOL) isSupported;
  107. /**
  108. * Check the version of this `UnityAds` SDK
  109. *
  110. * @return String representing the current version name.
  111. */
  112. + (NSString *) getVersion;
  113. /**
  114. * Check that `UnityAds` has been initialized. This might be useful for debugging initialization problems.
  115. *
  116. * @return If `YES`, Unity Ads has been successfully initialized.
  117. */
  118. + (BOOL) isInitialized;
  119. /**
  120. * Get request token.
  121. *
  122. * @return Active token or null if no active token is available.
  123. */
  124. + (NSString *__nullable)getToken;
  125. /**
  126. * Get request token.
  127. *
  128. * @param completion Active token or null if no active token is available.
  129. */
  130. + (void)getToken: (void (^)(NSString *_Nullable))completion;
  131. @end
  132. NS_ASSUME_NONNULL_END