# 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.

> **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.

1. **Objective-C**

   ```objective-c
     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
       }
     }];
   ```

2. **Swift**

   ```swift
     let mediationInfo = UADSMediationInfo(
     name: "mediation",
     version: "1.0.0",
     adapterVersion: "1.0.0"
   )

   let config = UADSInitializationConfigurationBuilder(gameId: gameId)
     .with(testMode: true)
     .with(mediationInfo: mediationInfo)
     .with(logLevel: .debug)
     .build()

   UnityAds.initialize(config) { error in
     if let error = error {
         // Handle error
     }
   }
   ```

**Next steps**: To continue your implementation, refer to the [Implement interstitial ads in iOS](/ads-ios/4.19.0/sdk-integration/interstitial-ads.md) documentation.
