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
- Xcode v.15.1 or higher
- Target devices running iOS v.12.0 or higher
- CocoaPods v.1.13.0 or higher (if using CocoaPods to add the SDK)
- Recommended: Create a Liftoff account and register an app
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:
- In Xcode, navigate to File → Add Packages.
- In the prompt, search for the VungleAds Swift Package GitHub repository:
https://github.com/Vungle/VungleAdsSDK-SwiftPackageManager.git
. - 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
- 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. - 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 :
- Inside the Xcode Project navigator, open the
Info.plist
file. - To create a new property key, click the add button (+) next to a key in a property list inside the
Info.plist
file. - Enter
SKAdNetworkItems
and select ‘Array’ in the Type column. - Add a dictionary item, then add a single String item inside the dictionary.
- 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.
- Open your project file (or workspace if you are using CocoaPods).
- Add the following import in your App Delegate (or App file if using SwiftUI):
import VungleAdsSDK
#import <VungleAdsSDK/VungleAdsSDK.h>
- Add the following code snippet in your App Delegate (or App file if using SwiftUI):
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") }
[VungleAds initWithAppId:@"" completion:^(NSError * _Nullable error) { if (error) { NSLog(@"Error initializing SDK"); } else { NSLog(@"Init is complete"); } }]; if ([VungleAds isInitialized]) { NSLog(@"SDK is initialized"); } else { NSLog(@"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:
- Integrate Interstitial Ads
- Integrate Rewarded Ads
- Integrate Banner Ads
- Integrate Native Ads
- Integrate App Open Ads
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.