Documentation

​
​

Development

User Acquisition

Monetization

Industry

Unity Ads Monetization

Unity Ads Android SDK

Unity Ads iOS SDK

Unity Ads SDK

Unity Ads Monetization

Unity Ads Monetization
​
​
iOS developer guide
  • iOS SDK overview
  • Integration requirements
  • Install the Unity Ads SDK for iOS
  • Initialize the SDK in iOS
  • Implement interstitial ads in iOS
  • Implement rewarded ads in iOS
  • Implement banner ads in iOS
iOS 14 integration
  • iOS 14 technical integration
  • Update your Unity Ads SDK for iOS 14
  • Install the iOS 14 support package
  • Configure ad network IDs
  • App Tracking Transparency compliance
iOS SDK API reference
  • Unity Ads for iOS API reference (Objective-C)
  1. Grow your game
  2. Unity Ads
  3. Unity Ads SDK integration guide for iOS developers

Initialize the SDK in iOS

Initialize the Unity Ads SDK in your iOS app. Set your Game ID and use a delegate to manage initialization callbacks and enable ad monetization.
Read time 2 minutes
Last updated 4 months ago

Important
Initialize the SDK early in your project's run-time life cycle before you need to show ads.

ViewController.h

In your
ViewController
header (
.h
), import Unity Ads and set the following delegates:
  • UnityAdsInitializationDelegate
    handles callbacks for initialization succeeding or failing.
  • UnityAdsLoadDelegate
    handles callbacks for Ad Units succeeding or failing to load content.
  • UnityAdsShowDelegate
    handles callbacks for Ad Units succeeding or failing to show loaded content.
#import <UnityAds/UnityAds.h>@interface ViewController : UIViewController<UnityAdsInitializationDelegate,UnityAdsLoadDelegate,UnityAdsShowDelegate>@property (assign, nonatomic) BOOL testMode;

ViewController.m

To initialize the SDK, you must reference your project's Game ID for the appropriate platform. You can locate the ID in the Unity Monetization Dashboard by selecting CURRENT PROJECT > Settings from the secondary navigation menu
In your
ViewController
implementation (
.m
), create a
UnityAdsInitializationDelegate
delegate to handle initialization callbacks, and reference it as a parameter in the
initialize
method.

SDK initialization example

- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.[UnityAds initialize:kDefaultGameId testMode:self.testMode initializationDelegate:self];}// Implement initialization callbacks to handle success or failure:#pragma mark : UnityAdsInitializationDelegate- (void)initializationComplete {NSLog(@" - UnityAdsInitializationDelegate initializationComplete" );// Pre-load an ad when initialization succeeds, so it is ready to show:[UnityAds load:@"Interstitial_iOS" loadDelegate:self];}- (void)initializationFailed:(UnityAdsInitializationError)error withMessage:(NSString *)message {NSLog(@" - UnityAdsInitializationDelegate initializationFailed with message: %@", message );}// Implement load callbacks to handle success or failure after initialization:#pragma mark: UnityAdsLoadDelegate- (void)unityAdsAdLoaded:(NSString *)placementId {NSLog(@" - UnityAdsLoadDelegate unityAdsAdLoaded %@", placementId);}- (void)unityAdsAdFailedToLoad:(NSString *)placementId withError:(UnityAdsLoadError)error withMessage:(NSString *)message {NSLog(@" - UnityAdsLoadDelegate unityAdsAdFailedToLoad %@", placementId);}
Next steps: To continue your implementation, refer to the Implement interstitial ads in iOS documentation.

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • ViewController.h

    • ViewController.m

    • SDK initialization example


Report a problem with this page