Setting up the Chat SDK

This is the developer guide for Chat SDK v1. The new Chat SDK v2 for iOS is now available and is the recommended version to integrate Chat into your mobile app. It also removes the dependency on UIWebView which has been deprecated by Apple.

This document describes how to add the Chat SDK to your project and initialize it in your application. After completing this setup, see Starting and configuring a chat.

Adding the Chat SDK to a project

You can add the Chat SDK to your project with CocoaPods or manually in Xcode.

Adding the SDK with CocoaPods

CocoaPods is a dependency manager that lets you add third-party frameworks and libraries to projects. For installation instructions, see Install CocoaPods.

If not already done, create a Podfile for your project as follows:

  1. In Terminal, navigate to the top-level folder of your project (the one with the xcodeproj file).

  2. Create a Podfile with the following command:

    pod init

  3. Open the file in Xcode with the following command:

    open -a Xcode Podfile

    The content should look as follows:

    # Uncomment this line to define a global platform for your project
    # platform: ios, '9.0'
    target 'My Sample App' do
  4. If you're using Objective-C, comment out use_frameworks!.

Add the Chat SDK to your Podfile and install the SDK in your project as follows:

  1. Add pod 'ZDCChat' to the do block:

    target 'My Sample App' do
      pod 'ZDCChat'

    To install only the ChatAPI and build the UIs yourself:

      pod 'ZDCChat/API'
  2. Save the Podfile.

  3. Run the following command in Terminal:

    pod install

    Note: If you installed a previous version of the SDK with CocoaPods, run pod update ZDCChat first to update the SDK pod on your system.

Because your project now contains a dependency managed by CocoaPods, you must open the project in Xcode by double-clicking the .xcworkspace file, not .xcodeproj .

For more information, see Using CocoaPods on

Adding the SDK manually
  1. Download the ZIP file from the Chat SDK repo on Github, and unzip the file on your hard drive.

  2. In XCode, select your project in Project navigator:


  3. Select File > Add Files to "your_project_name" from the Xcode menu.

  4. Navigate to the unzipped SDK folder and multi-select the following items:

    • ZDCChat.bundle
    • ZDCChat.framework
    • ZDCChatAPI.framework
    • ZDCChatStrings.bundle

    To install only the ZDCChatAPI and build the UIs yourself, you only need ZDCChatAPI.framework.

  5. Make sure the rest of the Add Files settings are set as follows:

    • Destination - select Copy items if needed
    • Added folders - select Create groups
    • Add to targets - make sure your application and all relevant targets are selected

    adding framework and bundle to project and targets

    Important: If you get link errors when building the project, you may have to add MobileCoreServices.framework to your project. The framework doesn't always get added automatically.

  6. Add the -ObjC linker flag to Other Linker Flags in the Build Settings of the target that imports ZDCChat.

Initializing the Chat SDK

The Chat SDK should be initialized in the following method in the application delegate:


- application:didFinishLaunchingWithOptions:`

Swift 3


The method runs just before the application moves to the active state.

The initialization code requires a Zendesk Chat account key. You'll need access to the Zendesk Chat dashboard to get the key. If you don't have access, ask somebody who does to perform the first 2 steps.

  1. In the Zendesk Chat dashboard, click your avatar in the upper-right corner, then select Check Connection.

    check connection

  2. Copy and save the account key. It should be the second item in the list.

    account key

  3. In your project in Xcode, add the following import statement at the top of the AppDelegate file:


    #import <ZDCChat/ZDCChat.h>

    Swift 3

    import ZDCChat
  4. Add the the following initialization code to the delegate method:


    [ZDCChat initializeWithAccountKey:@"your_account_key"];


    ZDCChat.initialize(withAccountKey: "your_account_key")

    Replace the "your_account_key" placeholder with the account key from the Zendesk Chat dashboard.

    For additional settings you can set on initialization, see ZDCConfig.