文档

​
​

Development

User Acquisition

Monetization

工业

Unity Ads Monetization

SDK 4.20.0

受支持
​

iOS API reference - Swift

iOS API reference - Objective-C

Unity Ads Monetization

SDK 4.20.0

受支持
​

此页面不支持所选语言。
iOS developer guides
​
​
iOS developer guides
  • iOS SDK integration guide
  • Unity Ads privacy guide
  • Unity Ads SDK troubleshooting guide
  • iOS developer API references - Swift
  • iOS developer API references - Objective-C
  1. Unity Ads SDK iOS developer monetization
  2. Unity Ads SDK integration guide for iOS developers

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.
阅读时间2 分钟
最后更新于 1 个月前

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
UADSLoadConfigurationBuilder
to construct a load request with the placement ID, mediation metadata, and optional ad markup for bidding, then pass it to
UADSRewardedAd.load()
. The completion block receives the loaded
UADSRewardedAd
instance on success. Retain it, as it's required to show the ad later, or an error object on failure.
Ads expire a set time after they load if they aren't shown. Assign
onAdExpired
on the loaded ad instance to detect this. Attempting to
show()
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
load()
call so a fresh ad is ready when needed.
@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 }; }}];
var rewardedAd: UADSRewardedAd?let config = UADSLoadConfigurationBuilder(placementId: placementId) .with(mediationInfo: mediationInfo) .with(adMarkup: bidResponse) .build()UADSRewardedAd.load(config) { ad, error in if let error = error { // Handle error } else { self.rewardedAd = ad ad?.onAdExpired = { [weak self] _ in self?.rewardedAd = nil // reload here } }}

Rewarded video ad show and reward handling example

Call
show()
on the retained
UADSRewardedAd
instance, passing a
UADSShowConfiguration
built with the presenting view controller, and a
UADSRewardedShowDelegate
. In addition to the standard
showDidStart
,
showDidClick
,
showDidComplete
, and
showDidFail
callbacks, the delegate provides a dedicated
showDidReceiveReward
callback that fires when the user earns a reward. Grant the reward in
showDidReceiveReward
rather than in
showDidComplete
to avoid conditional completion-state checks.
@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];
class MyDelegate: NSObject, UADSRewardedShowDelegate {func showDidStart(_ unityAd: UADSRewardedAd) {}func showDidClick(_ unityAd: UADSRewardedAd) {}func showDidComplete( _ unityAd: UADSRewardedAd, with finishState: UADSShowFinishState) {}func showDidFail( _ unityAd: UADSRewardedAd, error: UnityAdsError) {}func showDidReceiveReward(_ unityAd: UADSRewardedAd) { // reward callback }}let config = UADSShowConfigurationBuilder() .with(viewController: viewController) .build()rewardedAd?.show(config, delegate: delegate)
Next steps: To expand your implementation, refer to Implement banner ads in iOS.

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。

  • 在本页上
    • Rewarded video ad load example

    • Rewarded video ad show and reward handling example


报告此页面的问题