Add and initialize the 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
- In a text editor, open Podfile.
- Add
pod 'SpotIMCore', '1.18.1
- 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.18.1'
pod 'Google-Mobile-Ads-SDK', '8.0'
end
- In Terminal at the terminal prompt of your project directory, execute
pod install
to install the dependencies added to Podfile. - 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.18.1"))
]
Initialize the SDK
- In the AppDelegate.swift, import the OpenWeb iOS SDK (
import SpotImCore
) and initialize the SDK inapplication(application:didFinishLaunchingWithOptions)
. Be sure to replaceSPOT_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
}
- In the project info.plist file, add
NSPhotoLibraryUsageDescription
andNSCameraUsageDescription
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>
Updated 22 days ago