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.

UnityAdsDelegate.h 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #import <UnityAds/UnityAdsFinishState.h>
  2. #import <UnityAds/UnityAdsError.h>
  3. NS_ASSUME_NONNULL_BEGIN
  4. /**
  5. * The `UnityAdsDelegate` protocol defines the required methods for receiving messages from UnityAds.
  6. * Must be implemented by the hosting app.
  7. * The unityAdsReady: method is called when it's possible to show an ad.
  8. * All other methods are used to provide notifications of events of the ad lifecycle.
  9. * @note On initialization, there are ready (or error) callbacks for each placement attached to the game identifier.
  10. */
  11. @protocol UnityAdsDelegate <NSObject>
  12. /**
  13. * Called when `UnityAds` is ready to show an ad. After this callback you can call the `UnityAds` `show:` method for this placement.
  14. * Note that sometimes placement might no longer be ready due to exceptional reasons. These situations will give no new callbacks.
  15. *
  16. * @warning To avoid error situations, it is always best to check `isReady` method status before calling show.
  17. * @param placementId The ID of the placement that is ready to show, as defined in Unity Ads admin tools.
  18. */
  19. - (void)unityAdsReady: (NSString *)placementId;
  20. /**
  21. * Called when `UnityAds` encounters an error. All errors will be logged but this method can be used as an additional debugging aid. This callback can also be used for collecting statistics from different error scenarios.
  22. *
  23. * @param error A `UnityAdsError` error enum value indicating the type of error encountered.
  24. * @param message A human readable string indicating the type of error encountered.
  25. */
  26. - (void)unityAdsDidError: (UnityAdsError)error withMessage: (NSString *)message;
  27. /**
  28. * Called on a successful start of advertisement after calling the `UnityAds` `show:` method.
  29. *
  30. * @warning If there are errors in starting the advertisement, this method may never be called. Unity Ads will directly call `unityAdsDidFinish:withFinishState:` with error status.
  31. *
  32. * @param placementId The ID of the placement that has started, as defined in Unity Ads admin tools.
  33. */
  34. - (void)unityAdsDidStart: (NSString *)placementId;
  35. /**
  36. * Called after the ad has closed.
  37. *
  38. * @param placementId The ID of the placement that has finished, as defined in Unity Ads admin tools.
  39. * @param state An enum value indicating the finish state of the ad. Possible values are `Completed`, `Skipped`, and `Error`.
  40. */
  41. - (void)unityAdsDidFinish: (NSString *)placementId
  42. withFinishState: (UnityAdsFinishState)state;
  43. @end
  44. NS_ASSUME_NONNULL_END