Skip to main content

iOS - Integration Guide

Prerequisites


Before you start to integrate Vpon SDK, please make sure you already have your own Vpon Publisher Account and get your License Key. Register as a Vpon Publisher if you haven’t own your Publisher Account.

Once you have your own Publisher Account, follow the instruction below to integrate Vpon iOS SDK to your Xcode project.

Import SDK


Vpon provides two ways to integrate our SDK. Choose one of the following two options:

Integrate SDK with CocoaPods

Note: CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. If you haven’t installed CocoaPods in your device for development, please refer to CocoaPods Introduction

1. Create Podfile

1.1 Launch your terminal and change the directory to your Xcode project. Use pod init to initialize and generate a Podfile.
1.2 Open the Podfile. Uncomment the description about the platform version and modify it to the corresponding one.
1.3 Add the description about SDK version to the target section of the podfile. The description depends on whether the publishers assign a specified version of SDK :

  • Non specific version (Preferred): download the latest version automatically → pod 'VpadnSDK'
  • Specific version: (Take SDK 5.4.2 for example) → pod 'VpadnSDK', '~>5.4.2'

2. Run pod install

Make sure your current directory in terminal is the same as your Xcode project. Close the project (.xcodeproj) and run pod install to install SDK.

You’ll see a new project file (.xcoworkspace) in your Xcode project directory. A Pods project with new dependencies for VpadnSDK will included.

Note: To update to the latest SDK, please change your directory in terminal to your Xcode project. Run pod repo update to refresh the podspec and use pod install again to install SDK.

Integrate SDK Manually

Please download latest Vpon SDK here before you start your integration.

Import Framework SDK

First, right click on your project and choose Add Files to your_project

Second, add VpadnSDKAdKit.xframework into your project.

Remember to check whether the framework in Linked Frameworks and Libraries under General has been added.

Third, find Other Linker Flags under Build Settings and input -ObjC

Finally, import the framework:

@import VpadnSDKAdKit

Note: Remind again that the Framework SDK only support devices in iOS version higher than 7.0. Do not use this SDK if your app targets at users with devices OS version lower than 7.0.

SDK Initialization


Please follow the tips below to initialize Vpon SDK if you are using Vpon SDK v4.9.3 or above version.

Objective-C

Please add below code snipet in your AppDelegate.m if you are using Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Vpon SDK initialization
    VpadnAdConfiguration *config = [VpadnAdConfiguration sharedInstance];
    config.logLevel = VpadnLogLevelDefault;
    [config initializeSdk];

    return YES;
}

Swift

Please add below code snipet in your AppDelegate.swift if you are using Swift:

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:      
    [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        // Vpon SDK initialization
        let config = VpadnAdConfiguration.sharedInstance()
        config.logLevel = .default
        config.initializeSdk()

        return true
    }

Note:

To comply with 3rd-party tracking vendors’ requirement, Vpon SDK will set the Audio Session Category of the App as AVAudioSessionCategoryPlayBack / OptionsWithMixWithOthers (The audio play in the app will be mixable, and the audio playing won’t be impacted by the Ring/Silent swtich on iPhone). You can reassign and activate the Audio Session Category after SDK initilization.

To ask not to change the audio session category, please refer to Advanced Setting for further instruction.

Usage Description


Vpon SDK have the ability to deliver diverse ad experience. To display specific types of ads, below permission might be required:

<key>NSCalendarsUsageDescription</key>
<key>NSCameraUsageDescription</key>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<key>NSLocationUsageDescription</key>
<key>NSLocationWhenInUseUsageDescription</key>
<key>NSPhotoLibraryUsageDescription</key>

Note: You might need to describe the usage of above permission when you submit your App to App Store after you finish Vpon SDK integration. For example, you might need to add the usage description of Calendar with: We might need to add some events to Calendar.

Tips


For more ad types, please refer to: