Getting started

Learn how to add the OpenWeb SDK to your iOS app.

The iOS SDK enables you to create a fluent conversation experience in your iOS app that fuels quality interactions with community and content and allows users to create valuable and engaging content. Benefits of the iOS SDK include the following:

  • SSO support
  • Customizable Conversation appearance
  • Ability to continue Conversation started on your web pages

Additionally, the iOS SDK supports real-time moderation and single sign-on.

814

Mobile screenshots



Requirements

  • iOS 11.0 or later
  • OpenWeb account
  • Xcode


Add and initialize the iOS SDK

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


Add the SDK

You can add the iOS SDK using either Cocoapods or Swift Package Manager.


Using Cocoapods

  1. In a text editor, open Podfile.
  2. Add pod 'SpotIMCore', '1.18.3.
  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

  # Pod for OpenWeb-SDK
  pod 'SpotIMCore', '1.18.3'

  # Optional for monetization
  # 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, all you have to do is add SpotIM to the dependencies value of your Package.swift.

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

Initialize the SDK

  1. In the AppDelegate.swift, import the OpenWeb iOS SDK (import SpotImCore) and initialize the SDK in application(application:didFinishLaunchingWithOptions). Define your 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 NSPhotoLibraryUsageDescription and 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>