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


You can install Vpon SDK through CocoaPods.

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.6.1 for example) → pod 'VpadnSDK', '~>5.6.1'

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.

SDK Initialization


Please follow the tips below to initialize Vpon SDK.

Objective-C

// Using Vpon SDK v560 and above
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Vpon SDK initialization
    VponAdConfiguration *config = VponAdConfiguration.shared;
    config.logLevel = VponLogLevelDefault;
    [config initializeSdk];

    return YES;
}

// Using Vpon SDK v560 below
- (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:

// Using Vpon SDK v560 and above
 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:      
    [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        // Vpon SDK initialization
        let config = VponAdConfiguration.shared
        config.logLevel = .default
        config.initializeSdk()

        return true
    }

// Using Vpon SDK v560 below
 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.

  • Vpon SDK will stop supporting deprecated method using in v5.5.0 and below version. Please follow the integration guide on this site and do not use any method that are not described on the site.

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: