Implement rewarded ads in iOS
Implement rewarded ads in your iOS app. Load ad content, display it through Objective-C or Swift code, and use a delegate to manage ad events and reward logic.
Read time 2 minutesLast updated a month ago
Rewarding players for watching ads increases user engagement, resulting in higher revenue. For example, games might reward users with in-game currency, consumables, additional lives, or experience-multipliers. For more information on how to effectively design your rewarded ads, refer to the monetization strategy guide.
Rewarded video ad load example
Use to construct a load request with the placement ID, mediation metadata, and optional ad markup for bidding, then pass it to . The completion block receives the loaded instance on success. Retain it, as it's required to show the ad later, or an error object on failure.
UADSLoadConfigurationBuilderUADSRewardedAd.load()UADSRewardedAdAds expire a set time after they load if they aren't shown. Assign on the loaded ad instance to detect this. Attempting to an expired rewarded ad fails, which is especially important to catch since rewarded ads are often preloaded and held until the user requests a reward. Use the callback to clear your stored reference and issue a new call so a fresh ad is ready when needed.
onAdExpiredshow()load()@property (strong) UADSRewardedAd *rewardedAd;UADSLoadConfigurationBuilder *builder = [[UADSLoadConfigurationBuilder alloc] initWithPlacementId:placementId];builder = [builder withMediationInfo:self.mediationInfo];builder = [builder withAdMarkup:bidResponse];[UADSRewardedAd load:[builder build] completion:^(UADSRewardedAd *ad, id<UnityAdsError> error) { if (error) { // Handle error } else { __weak typeof(self) weakSelf = self; ad.onAdExpired = ^(UnityAd *expiredAd) { weakSelf.rewardedAd = nil; // reload here }; }}];
Rewarded video ad show and reward handling example
Call on the retained instance, passing a built with the presenting view controller, and a . In addition to the standard , , , and callbacks, the delegate provides a dedicated callback that fires when the user earns a reward. Grant the reward in rather than in to avoid conditional completion-state checks.
show()UADSRewardedAdUADSShowConfigurationUADSRewardedShowDelegateshowDidStartshowDidClickshowDidCompleteshowDidFailshowDidReceiveRewardshowDidReceiveRewardshowDidComplete@interface MyDelegate : NSObject <UADSRewardedShowDelegate>@end@implementation MyDelegate- (void)showDidStart:(UADSRewardedAd *)unityAd {}- (void)showDidClick:(UADSRewardedAd *)unityAd {}- (void)showDidComplete:(UADSRewardedAd *)unityAd with:(UADSShowFinishState)finishState {}- (void)showDidFail:(UADSRewardedAd *)unityAd error:(id<UnityAdsError>)error {}- (void)showDidReceiveReward:(UADSRewardedAd *)unityAd { // reward callback}@endUADSShowConfigurationBuilder *builder =[[UADSShowConfigurationBuilder alloc] init];builder = [builder withViewController:viewController];[self.rewardedAd show:[builder build] delegate:delegate];
Next steps: To expand your implementation, refer to Implement banner ads in iOS.