iOS Swift Integration Guide


Follow this guide to integrate our SDK into your Swift environment.

Note: Due to GDPR regulations, NinthDecimal is now blocking all ad requests from the affected EEA regions.

Getting Started

First, make sure you’re registered for a developer account at Adding an app to your developer account will issue an app key and secret necessary to integrate the NinthDecimal SDK.

Integrate NinthDecimal

If you don’t have a bridging header, make sure to create one.

Mix and Match

Make it look something like this:

#import <UIKit/UIKit.h>
#import <KiipSDK/KiipSDK.h>

### Using Cocoapods

If you're using Cocoapods, you can integrate the NinthDecimal SDK using a Podfile. If you're not using Cocoapods, skip this section.

If creating your first Podfile, uncomment these two lines of code (or add them).

<figure class="highlight"><pre><code class="language-objc" data-lang="objc"><span class="n">platform</span> <span class="o">:</span><span class="n">ios</span><span class="p">,</span> <span class="err">'</span><span class="mi">9</span><span class="p">.</span><span class="mi">0</span><span class="err">'</span>

<span class="n">use_frameworks</span><span class="o">!</span></code></pre></figure>

In your Podfile, add the following pod command.

<figure class="highlight"><pre><code class="language-objc" data-lang="objc"><span class="n">pod</span> <span class="err">'</span><span class="n">KiipSDK</span><span class="err">'</span></code></pre></figure>

Navigate to your project folder in a terminal window, and run the following command:

<figure class="highlight"><pre><code class="language-objc" data-lang="objc"><span class="n">pod</span> <span class="n">install</span></code></pre></figure>

Open up "YOUR_PROJECT_NAME".xcworkspace and click on your project and go to the "Build Setting."
Under Build Option, there is a field called "Always Embed Swift Standard Libraries." Mark this as "Yes."

For more information about using CocoaPods with your app, see the [CocoaPods Getting Started Guide]( 
Make sure you have the [CocoaPods]( gem installed on your machine before attempting to install any KiipSDK pods.

Add the Necessary Frameworks

If you’re not using Cocoapods, use the following methods to integrate NinthDecimal. Before you compile and build, do the following:

  1. Drag in the KiipSDK.framework from the NinthDecimal SDK folder to your frameworks section.

  2. Drag in the KiipSDKResources.bundle to your resources section. This is located inside the KiipSDK.framework directory.

  3. Link the following frameworks inside your Build Phases:

    • CoreTelephony.framework
    • QuartzCore.framework
    • SystemConfiguration.framework
    • AdSupport.framework
    • Passkit.framework
    • MediaPlayer.framework

Initialize NinthDecimal

Now that you can compile this without any NinthDecimal code, let’s initialize the NinthDecimal singleton inside your AppDelegate.swift file. Navigate to the didFinishLaunchingWithOptions method. It should look like the following:

class AppDelegate: UIResponder, UIApplicationDelegate, KiipDelegate {

    let KP_APP_KEY: String = "Insert-your-app-key"
    let KP_APP_SECRET: String = "Insert-your-app-secret"

    func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
        var kiip: Kiip = Kiip(appKey: KP_APP_KEY, appSecret: KP_APP_SECRET)
        kiip.delegate = self
        return true

Build and voila! You’ve successfully integrated Kiip into your Swift application.

Call a Kiip Moment

Now that the hard part is done, the next step is figuring out where you want to reward users. In test mode (the iOS Simulator is always test mode), you will receive a test reward for every moment call. It’s better to place more reward moments in your code now as you can control whether or not they are rewardable later without having to submit an update.

Find a good place to reward a user and try the following:

Kiip.sharedInstance().saveMoment("beating level one!" withCompletionHandler: {(poptart:KPPoptart!, error:NSError!) -> Void in
    if error {
        /* handle error */

    if !poptart {
        /* handle case with no reward to give*/
        println("Successful moment call but no reward to give.")

    if poptart {

Rewarding Virtual Currency

In case you’d like to give users your virtual currency as a reward, we’d recommend the following callback method inside where your KiipDelegate is set.

func kiip(kiip:Kiip, content:NSString, quantity:Int, transactionId:NSString, signature:NSString) {
    // Add quantity amount of content to player's profile
    // e.g +20 coins to user's wallet

Make sure virtual currency is enabled for your app. This setting can be found on the app’s profile page in the NinthDecimal dashboard.

This listener will be called by the NinthDecimal SDK after a user redeems a reward that carries a virtual currency value. We will pass a quantity of currency into the method under the quantity parameter and the name of the currency, if there are multiple, under the content parameter. You can then handle depositing the value via your in-game currency management.

If a user chooses not to redeem currency, then the value passed down will be zero.

If a virtual currency postback endpoint is provided to kiip, you can confirm issuance of virtual currency and gain access to additional virtual currency reward opportunities.

Rewarded Video

Access more inventory, increase engagement and drive more revenue with Rewarded Video. To utilize Rewarded Video, designate and individual moments placement in the NinthDecimal dashboard.

NinthDecimal Rewarded Video Moment

Sample Applications

In case you’d like to see code example projects, we have that as well. Navigate to our Github repo and check out our Swift examples.

Trouble with test rewards?

If your test device is not located in the US and you’re having trouble retrieving a test reward, please use a VPN with set to a US location.

VPN Assistance

We’re aware of occurances where developers using a US-based VPN experience IP leakage which prevents them from seeing test rewards. We suggest using a service like or a similar service to detect potential IP leaks to ensure you can test NinthDecimal successfully.

Need Help?

We’re happy to answer any questions about integrating NinthDecimal. Please email us.