Integrate Vungle SDK for iOS

This guide is for publishers who want to monetize an iOS app with Liftoff. Integrating the Vungle SDK into your app is the first step toward displaying ads and earning revenue. Once you've integrated the SDK, you can proceed to implement one or more of the supported ad formats.

Requirements

Step 1. Add the SDK

You can add the Vungle SDK either through CocoaPods (recommended), using the Swift Package Manager, or manually.

Option 1. CocoaPods (Recommended)

The Vungle SDK is available through CocoaPods, which provides pod support for XCFramework files. Add the following into your project’s Podfile (if your project doesn’t have a Podfile, first run pod init to add the Podfile to your project directory):

pod "VungleAds"

After that, a quick pod install run will update your project with the latest version of our iOS SDK.

pod install --repo-update

At this point you can skip the manual integration instructions and continue to Add SKAdNetwork IDs to Info.plist.

Option 2. Swift Package Manager

To install the VungleAds Swift Package in Xcode:

  1. In Xcode, navigate to File Add Packages.
  2. In the prompt, search for the VungleAds Swift Package GitHub repository: https://github.com/Vungle/VungleAdsSDK-SwiftPackageManager.git.
  3. Select the version of the VungleAds Swift Package you want to use. For new projects, we recommend using the Up to Next Major Version.

Option 3. Integrate Manually

  1. Download the latest version of the Vungle SDK for iOS and link VungleAdsSDK.xcframework in your project. For Swift projects, this is the only requirement.
  2. For Objective-C projects, create a bridging header in your project, if one does not already exist. To create a bridging header, create a new Swift file for your project, create the bridging header when prompted, and add the following import:
    import <VungleAdsSDK/VungleAdsSDK.h>

Continue to Add SKAdNetwork IDs to Info.plist below.

Add SKAdNetwork IDs to Info.plist

Configure your app to participate in ad campaigns via the SKAdNetwork framework on iOS 14+. To do this, add the list of our approved partner IDs for advertising attribution to your Info.plist file. Adding the Vungle SKAdnetwork ID and the IDs of all the DSPs to whom you want to sell indicates that your app wants to work with Vungle and accept bids from these buyers.

Refer to Apple’s documentation on configuring the Info.plist properly for ad campaigns to be served. Refer also to the Xcode documentation for help on editing property lists. If you’re unfamiliar with App Tracking Transparency (ATT), we recommend reviewing Apple’s documentation on ATT as part of this process.

Follow these steps to configure your app with SKAdNetworkIDs :

  1. Inside the Xcode Project navigator, open the Info.plist file.
  2. To create a new property key, click the add button (+) next to a key in a property list inside the Info.plist file.
  3. Enter SKAdNetworkItems and select ‘Array’ in the Type column.
  4. Add a dictionary item, then add a single String item inside the dictionary.
  5. For each String item, add SKAdNetworkIdentifier as the key and the ad network identifier as the value.

Vungle hosts the Vungle SKAdNetwork ID and the list of our buyers' SKAdNetwork IDs in both JSON and XML formats on our website. Note that our lists are updated periodically:

Privacy Manifest Support

VungleAds SDK 7.3.1+ integrates a Privacy Manifest file to comply with Apple's Privacy Manifest Framework

Required reasoning API 

Below are the required reasoning APIs that VungleAds SDK uses. 

Required reasoning APIs API Type Reason
File Timestamp APIs  NSPrivacyAccessedAPICategoryFileTimestamp C617.1
Disk Space APIs NSPrivacyAccessedAPICategoryDiskSpace E174.1
User Defaults APIs NSPrivacyAccessedAPICategoryUserDefaults CA92.1

 

Step 2. Initialize the SDK

After you have successfully installed the SDK, you must initialize it.

  1. Open your project file (or workspace if you are using CocoaPods).
  2. Add the following import in your App Delegate (or App file if using SwiftUI):
    SwiftObjective-C
    import VungleAdsSDK
  3. Add the following code snippet in your App Delegate (or App file if using SwiftUI):
    SwiftObjective-C
    VungleAds.initWithAppId("<YOUR_APP_ID>") { error in
        if let error = error {
            print("Error initializing SDK")
        } else {
            print("Init is complete")
        }
    }
    
    if (VungleAds.isInitialized()) {
        print("SDK is initialized")
    } else {
        print("SDK is NOT initialized")
    }

Step 3. Integrate Ad Formats

Complete the SDK integration for each ad format you plan to display in your app. Refer to our instructions for each ad format:

Step 4. Further Customize Your Ads

Follow the instructions in our Advanced Settings article to fine-tune your app's integration with additional configuration options, such as GDPR, CCPA implementation, and other settings.

Questions?

Need further assistance, feel free to reach out to us, we’re here to help!

Was this article helpful?