MPRewardedAds /+5.16.0
@interface MPRewardedAds : NSObject
MPRewardedAds
enables you to load and play rewarded ads. All ad events are reported, with an ad unit ID, to the delegate allowing the application to respond to the events for the corresponding ad.
Public Methods
+/setDelegate:forAdUnitId: /+5.16.0
-
Description: Sets the delegate that will be the receiver of rewarded ad events for the given ad unit ID. A weak reference to the delegate will be held.
-
Declaration:
+ (void)setDelegate:(id<MPRewardedAdsDelegate>)delegate forAdUnitId:(NSString *)adUnitId;
-
Parameters:
delegate
: Delegate that will receive rewarded ad events for the ad unit ID.adUnitId
: Ad unit ID.
+/removeDelegate: /+5.16.0
-
Description: Removes the delegate as a receiver of rewarded ad events for all available ad unit IDs.
-
Declaration:
+ (void)removeDelegate:(id<MPRewardedAdsDelegate>)delegate;
-
Parameters:
delegate
: Reference to the delegate to remove as a listener.
+/removeDelegateForAdUnitId: /+5.16.0
-
Description: Removes the rewarded ad delegate that is associated with the ad unit ID.
-
Declaration:
+ (void)removeDelegateForAdUnitId:(NSString *)adUnitId;
-
Parameters:
adUnitId
: Ad unit ID of the delegate to remove.
+/loadRewardedAdWithAdUnitID:withMediationSettings: /+5.16.0
-
Description: Loads a rewarded ad for the given ad unit ID. The mediation settings array should contain ad network-specific objects for networks that may be loaded for the given ad unit ID. You should set the properties on these objects to determine how the underlying ad network should behave. Only supply objects for the networks you wish to configure. To prevent your network from straying from its default behavior, do not pass in a mediation settings object for that network.
-
Declaration:
+ (void)loadRewardedAdWithAdUnitID:(NSString *)adUnitID withMediationSettings:(NSArray *)mediationSettings;
-
Parameters:
adUnitID
: The ad unit ID from which ads should be loaded.mediationSettings
: An array of mediation settings objects that map to networks that may show ads for the ad unit ID. This array should only contain objects for networks you wish to configure. This can benil
.+/loadRewardedAdWithAdUnitID:keywords:userDataKeywords:customerId:mediationSettings: /+5.16.0
-
Description: Loads a rewarded ad for the given ad unit ID. The mediation settings array should contain ad network-specific objects for networks that may be loaded for the given ad unit ID. Set the properties on these objects to determine how the underlying ad network should behave. Only supply objects for the networks you wish to configure. To prevent your network from straying from its default behavior, do not pass in a mediation settings object for that network.
Note that if a user is in a General Data Protection Regulation (GDPR) region and MoPub doesn’t obtain consent from the user,
keywords
will be sent to the server butuserDataKeywords
will be excluded. -
Declaration:
+ (void)loadRewardedAdWithAdUnitID:(NSString *)adUnitID keywords:(NSString *)keywords userDataKeywords:(NSString *)userDataKeywords customerId:(NSString *)customerId mediationSettings:(NSArray *)mediationSettings;
-
Parameters:
adUnitID
: The ad unit ID from which ads should be loaded.keywords
: A string representing a set of non-personally-identifiable keywords that should be passed to the MoPub ad server to receive more relevant advertising.userDataKeywords
: A string representing a set of personally identifiable keywords that should be passed to the MoPub ad server to receive more relevant advertising.customerID
: This is the ID given to the user by the publisher to identify them in their app.mediationSettings
: An array of mediation settings objects that map to networks that may show ads for the ad unit ID. This array should only contain objects for networks you wish to configure. This can benil
.
+/loadRewardedAdWithAdUnitID:keywords:userDataKeywords:customerId:mediationSettings:localExtras: /+5.16.0
-
Description: Loads a rewarded ad for the given ad unit ID. The mediation settings array should contain ad network-specific objects for networks that may be loaded for the given ad unit ID. Set the properties on these objects to determine how the underlying ad network should behave. Only supply objects for the networks you wish to configure. To prevent your network from straying from its default behavior, do not pass in a mediation settings object for that network.
Note that if a user is in a General Data Protection Regulation (GDPR) region and MoPub doesn’t obtain consent from the user,
keywords
will be sent to the server butuserDataKeywords
will be excluded. -
Declaration:
+ (void)loadRewardedAdWithAdUnitID:(NSString *)adUnitID keywords:(NSString *)keywords userDataKeywords:(NSString *)userDataKeywords customerId:(NSString *)customerId mediationSettings:(NSArray *)mediationSettings localExtras:(NSDictionary *)localExtras;
-
Parameters:
adUnitID
: The ad unit ID from which ads should be loaded.keywords
: A string representing a set of non-personally-identifiable keywords that should be passed to the MoPub ad server to receive more relevant advertising.userDataKeywords
: A string representing a set of personally identifiable keywords that should be passed to the MoPub ad server to receive more relevant advertising.customerID
: This is the ID given to the user by the publisher to identify them in their app.mediationSettings
: An array of mediation settings objects that map to networks that may show ads for the ad unit ID. This array should only contain objects for networks you wish to configure. This can benil
.localExtras
: An optional dictionary containing extra local data.
+/hasAdAvailableForAdUnitID: /+5.16.0
-
Description: Returns whether or not an ad is available for the given ad unit ID.
-
Declaration:
+ (BOOL)hasAdAvailableForAdUnitID:(NSString *)adUnitID;
-
Parameters:
adUnitID
: The ad unit ID associated with the ad whose availability you wish to retrieve.
+/availableRewardsForAdUnitID: /+5.16.0
-
Description: Returns an array of rewards that are available for the given ad unit ID.
-
Declaration:
+ (NSArray *)availableRewardsForAdUnitID:(NSString *)adUnitID;
-
Parameters: None.
+/selectedRewardForAdUnitID: /+5.16.0
-
Description: The currently selected reward that will be awarded to the user upon completion of the ad. By default, this corresponds to the first reward in
availableRewardsForAdUnitID:
. -
Declaration:
+ (MPReward *)selectedRewardForAdUnitID:(NSString *)adUnitID;
-
Parameters: None.
+/presentRewardedAdForAdUnitID:fromViewController:withReward: /+5.16.0
-
Description: Plays a rewarded ad. Important: Do not attempt to play the rewarded ad unless
hasAdAvailableForAdUnitID:
indicates that an ad is available for playing, or you have received therewardedAdDidLoadForAdUnitID:
message. -
Declaration:
+ (void)presentRewardedAdForAdUnitID:(NSString *)adUnitID fromViewController:(UIViewController *)viewController withReward:(MPReward *)reward;
-
Parameters:
adUnitID
: The ad unit ID associated with the video ad you wish to play.viewController
: The view controller that will present the rewarded ad.reward
: A reward selected fromavailableRewardsForAdUnitID:
to award the user upon successful completion of the ad. This value should not benil
.
+/presentRewardedAdForAdUnitID:fromViewController:withReward:customData: /+5.16.0
-
Description: Plays a rewarded ad. Important: Do not attempt to play the rewarded ad unless
hasAdAvailableForAdUnitID:
indicates that an ad is available for playing, or you have received therewardedAdDidLoadForAdUnitID:
message. -
Declaration:
+ (void)presentRewardedAdForAdUnitID:(NSString *)adUnitID fromViewController:(UIViewController *)viewController withReward:(MPReward *)reward customData:(NSString *)customData;
-
Parameters:
adUnitID
: The ad unit ID associated with the video ad you wish to play.viewController
: The view controller that will present the rewarded ad.reward
: A reward selected fromavailableRewardsForAdUnitID:
to award the user upon successful completion of the ad. This value should not benil
.customData
: Optional custom data string to include in the server-to-server callback. If a server-to-server callback is not used, or if the ad unit is configured for local rewarding, this value will not be persisted.
Last updated February 16, 2021
TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.
© 2021 MoPub (a division of Twitter, Inc.)