Integrate with Enhance - Native iOS
Rewarded Ads
Rewarded Ads are usually full-screen video ads which users can view to receive a reward inside the app, like an additional in-game currency or a health bonus for example.
Example Usage
-(void)onRewardGranted:(int)rewardValue rewardType:(RewardType)rewardType { if(rewardType == REWARDTYPE_ITEM) { [self writeLog:@"Reward granted (item)"]; } else if(rewardType == REWARDTYPE_COINS) { [self writeLog:@"Reward granted (coins)"]; [self writeLog:[NSString stringWithFormat:@"Reward value: %d", rewardValue]]; } } -(void)onRewardDeclined { [self writeLog:@"Reward declined"]; } -(void)onRewardUnavailable { [self writeLog:@"Reward unavailable"]; } -(void)showAd { bool isRewardedAdReady = [Enhance isRewardedAdReady]; if(isRewardedAdReady) { [Enhance showRewardedAd:self]; } }
Methods
Enhance isRewardedAdReady
BOOL [Enhance isRewardedAdReady]
Return Value:
Returns true
if any ad is ready, false
otherwise. When app is not Enhanced, always returns true
.
Enhance isRewardedAdReady
BOOL [Enhance isRewardedAdReady:
(NSString*) placement
]
Parameters:
NSString* placement
- Specifies the internal placement of the ad (from the Enhance mediation editor).
Return Value:
Returns true
if any ad is ready, false
otherwise. When app is not Enhanced, always returns true
.
Enhance showRewardedAd
void [Enhance showRewardedAd:
(id) delegate
]
Parameters:
id delegate
- Specifies the callback object which is triggered when a reward is granted, declined or unavailable. Should implement the RewardDelegate
protocol. (See the Interfaces section for more information)
Enhance showRewardedAd
void [Enhance showRewardedAd:
(id) delegate,
placement:(NSString*) placement
]
Parameters:
id delegate
- Specifies the callback object which is triggered when a reward is granted, declined or unavailable. (For more information about the RewardCallback
type, see the Interfaces section).
NSString* placement
- Specifies the internal placement of the ad (from the Enhance mediation editor).
Protocols
protocol RewardDelegate
-(void)onRewardGranted:
(int)rewardValue
rewardType:(RewardType)rewardType;
-(void)onRewardDeclined;
-(void)onRewardUnavailable;
Properties
NSString* PLACEMENT_DEFAULT
The default internal placement of all ad types. Always equal to "default"
.
RewardType REWARDTYPE_ITEM
Indicates that the granted reward is a game-defined item.
RewardType REWARDTYPE_COINS
Indicates that the granted reward is a specific number of coins.