Documentation

Unity Ads Monetization


iOS API reference - Swift

iOS API reference - Objective-C

Unity Ads Monetization


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 1 minuteLast updated a day ago

Important
Initialize the SDK early in your project's run-time life cycle before you need to show ads.
Important
You must configure user consent before or during SDK initialization. Serving ads without consent configuration may violate privacy regulations in some regions.

SDK initialization example

Use
UADSInitializationConfigurationBuilder
to construct a configuration object with your Game ID, test mode flag, mediation metadata, and log level, then pass it to
UnityAds.initialize()
. The completion block receives an error object if initialization fails, or
nil
on success.
UADSMediationInfo *mediationInfo =[[UADSMediationInfo alloc] initWithName:@"mediation" version:@"1.0.0" adapterVersion:@"1.0.0"];UADSInitializationConfigurationBuilder *builder =[[[UADSInitializationConfigurationBuilder alloc] initWithGameId:gameId] withTestMode:YES];builder = [builder withMediationInfo:mediationInfo];builder = [builder withLogLevel:UADSLogLevelDebug];[UnityAds initialize:[builder build] completion:^(id<UnityAdsError> error) { if (error) { // Handle error }}];
Next steps: To continue your implementation, refer to the Implement interstitial ads in iOS documentation.