Add and initialize the OpenWeb iOS SDK

Add the OpenWeb SDK to your iOS app

To add a Conversation to your app, you must import the OpenWeb iOS SDK and then configure your project.



Add the SDK

Using Cocoapods

  1. In a text editor, open Podfile.
  2. Add pod 'SpotIMCore', '1.16.2
  3. Add pod 'Google-Mobile-Ads-SDK', '8.0'
target 'OpenWeb-SDK-iOS-Demo' do
  # Use one of those options
  use_frameworks!
  # use_frameworks! :linkage => :static

  # Pods for OpenWeb-SDK-iOS-Demo
  pod 'SpotIMCore', '1.16.2'
  pod 'Google-Mobile-Ads-SDK', '8.0'
end
  1. In Terminal at the terminal prompt of your project directory, execute pod install to install the dependencies added to Podfile.
  2. Open the .xcworkspace file for your project to launch Xcode.


Using Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. Once you have your Swift package set up, adding SpotIM as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/SpotIM/spotim-ios-sdk-pod.git", .upToNextMajor(from: "1.16.2"))
]


Initialize the SDK

  1. In the AppDelegate.swift, import the OpenWeb iOS SDK (import SpotImCore) and initialize the SDK in application(application:didFinishLaunchingWithOptions). Be sure to replace SPOT_ID with your Spot ID.
import SpotImCore

func application(_ application: UIApplication, 
                                didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]?) -> Bool { 
    SpotIm.initialize(spotId: "SPOT_ID")
    SpotIm.setGoogleAdsProvider(googleAdsProvider: GoogleAdsProvider())
    return true
}

  1. In the project info.plist file, add NSPhotoLibraryUsageDescriptionand NSCameraUsageDescription to enable users to add images to comments from a camera or photo library.
<key>NSPhotoLibraryUsageDescription</key>
<string>This app wants to use your photos.</string>
<key>NSCameraUsageDescription</key>
<string>This app wants to take pictures.</string>


Next Step
Did this page help you?