Chatbox SDKs
Give Feedback

iOS SDK

Updated on September 21, 2021

The iOS Chatbox SDK can be installed in a few lines of codes in any iOS app. The iOS SDK is native, and looks exactly the same as the Web-based chatbox.

Video Tutorial

Introduction Video


Installation

1. Install Crisp iOS SDK

Option 1: Using SwiftPM

To use the Crisp iOS SDK with SPM, add a dependency to your Package.swift file:

let package = Package(
  dependencies: [
    .package(url: "https://github.com/crisp-im/crisp-sdk-ios.git", ...)
  ]
)

Option 2: Using CocoaPods

Add Crisp to your CocoaPods Podfile:

use_frameworks!

target :YourTargetName do
  pod 'Crisp'
end

Then run: pod install

Option 3: Manual installation

  1. Download and extract the Crisp iOS SDK.
  2. Drag the Crisp.xcframework into your project, select Copy items if needed in the following dialog and click Finish.
  3. Finally, configure the Crisp.xcframework to Embed & Sign in the Frameworks, Libraries, and Embedded Content section of your app's target settings.
1. Drag framework to project
2. Copy items if needed
3. Embed and Sign

2. Update your Info.plist

To enable your users to take and upload photos to the chat as well as download photos to their photo library, add the Privacy - Camera Usage Description (NSCameraUsageDescription) and Privacy - Photo Library Additions Usage Description (NSPhotoLibraryAddUsageDescription) to your app's Info.plist.

Update Info.plist

3. Configure the Crisp iOS SDK

Go to your Crisp Dashboard, and copy your Website ID:

Copy your Website ID

Then, configure the Website ID in the SDK code:

import Crisp

// In your func application()
CrispSDK.configure(websiteID: "YOUR_WEBSITE_ID")
Configure CrispSDK

4. Present the ChatViewController

import Crisp

class ViewController: UIViewController {
    @IBAction func startChat(_ sender: Any) {
        self.present(ChatViewController(), animated: true)
    }
}
Present ChatViewController

Availables APIs

Swift APIs

  • CrispSDK.setTokenID(tokenID: "A_CUSTOM_ID") — Assigns session with a token_id
  • CrispSDK.user.email = "john.doe@gmail.com" — Sets user email
  • CrispSDK.user.nickname = "John Name" — Sets user name
  • CrispSDK.user.phone = "003370123456789" — Sets user phone
  • CrispSDK.user.avatar = URL(string: "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0_400x400.jpg") — Sets user avatar
  • CrispSDK.user.company = Company(name: "Acme", url: nil, companyDescription: nil, employment: nil, geolocation: nil) — Sets user compay
  • CrispSDK.session.setString("custom_value", forKey: "custom_key") — Sets session data string
  • CrispSDK.session.setInt(42, forKey: "custom_key") — Sets session data int
  • CrispSDK.session.pushEvent(SessionEvent(name: "Signup", color: SessionEventColor.blue)) — Sets Sends an event
  • CrispSDK.session.segment = "app" — Sets session segment
  • CrispSDK.session.reset() — Reset session