Rokt Documentation
  • Documentation
  • User Guide
  • SDK
  • API
  • Third-Party Integrations
  • Help

›Integrating the SDK

Getting Started

  • Introduction

Web SDK

  • Overview
  • Architecture
  • Integrating the Web SDK
  • Integration Examples

    • Confirmation Page Integration
    • Preparative Iframe
    • Page Identifier
    • Single Page Applications
    • Brand Conversion Integration
    • In Transaction/Cart Integration
    • Event-based Integration
    • Sandbox Integration
  • Integration Best Practices
  • Attributes
  • Security
  • Mobile In-App Web Pages
  • API

    • README
    • Globals

    Enumerations

    • FailureReason

    Interfaces

    • Attributes
    • Cart
    • CartItem
    • PlacementCloseEvent
    • Rokt
    • RoktConfiguration
    • Widget

iOS SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration
  • Attributes
  • Security

Android SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration

    Attributes

    • Core Attributes
    • Vertical Attributes
  • Security

React Native SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration

    Attributes

    • Core Attributes
    • Vertical Attributes
  • Security
Edit

Integrating and Initializing the SDK

The Rokt SDK for iOS Native Applications can be used by Rokt Partners to display overlay or embedded placements or by Rokt Brands to record conversions for their campaigns. The Rokt SDK for iOS is deployed using CocoaPod. This step by step guide assumes that you are familiar with CocoaPod and know how to install a Pod for iOS development. If not, please refer to https://guides.cocoapods.org/

All use cases of the SDK will follow the same initial steps to integrate and initialize the SDK in-app. At a high level, these steps are:

  1. Set-up a workspace using CocoaPod
  2. Add the “Rokt-Widget” to the pod file.
  3. Install the pod
  4. Initialize the Rokt SDK

Following these steps, the execute method of the SDK can then be used in various ways to suit the required use case.

Step 1: Set up a workspace using CocoaPod

To set up a workspace follow the tutorial from https://guides.cocoapods.org/using/using-cocoapods.html

Step 2: Add the Rokt-Widget pod to the pod file

Add the Rokt widget pod to the pod file

pod 'Rokt-Widget'

Step 3: Install the pod

Install the pod

pod install

Note on Objective-C integration: The Rokt SDK for iOS is implemented using Swift. To install the SDK if you are using Objective-C, you will need to import the bridging header file from the framework into the .h/.m file.

#import <Rokt_Widget/Rokt_Widget-Swift.h>

If you are having trouble installing and are receiving an error saying that the SWIFT_VERSION is not defined, please add a user defined variable SWIFT_VERSION. This variable should be set to "5" for iOS SDK versions 2.0 and above. This variable should be set to "4.2" for iOS SDK version 1.2.1.

Step 4: Initialize the Rokt SDK for iOS

Initialize the Rokt SDK for iOS prior to using it in any ViewController. It is recommended that the init method is called inside the applicationDidFinishLaunching handler.

Please contact Rokt for the Rokt Tag ID associated with your account. In order to test your integration, you can use the Rokt Tag ID below. Please note that this will need to be replaced by your unique Rokt Tag ID.

Test Integration Tag ID: 222

Swift

//file => AppDelegate.swift

import Rokt_Widget

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {  
// The following will reveal a demo integration. To view your integration, replace the integration test tag ID (222) with your unique Rokt Tag ID  
    Rokt.initWith(roktTagId: "222")  
    return true
}

Objective-C

//file => AppDelegate.m

#import <Rokt_Widget/Rokt_Widget-Swift.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      // Override point for customization after application launch.
      [Rokt initWithRoktTagId:@"222"];
      return YES;
}

The subsequent steps will depend on the use case of the integration. More details can be found here:

  • Launching an Overlay Placement
  • Launching an Embedded Placement
  • Recording a Brand Conversion
← VersionLaunching an Overlay Placement →
  • Step 1: Set up a workspace using CocoaPod
  • Step 2: Add the Rokt-Widget pod to the pod file
  • Step 3: Install the pod
  • Step 4: Initialize the Rokt SDK for iOS
RESOURCES
DocumentationUser GuideSDKAPIIntegration PartnersHelp
COMPANY
About UsContact UsCareersEngineering Blog
Rokt Documentation
Copyright © Rokt 2021 - All Rights Reserved