Adding the Chat SDK

You can add the Chat SDK to your project using one of the following methods:

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 using the pod init command.

  3. Add the ZendeskChatSDK pod to your Podfile.

    target 'My Sample App' do
        pod 'ZendeskChatSDK'
    end
    

    If you decide to build your own UI, then you will need to add the ZendeskChatProvidersSDK pod instead.

    target 'My Sample App' do
        pod 'ZendeskChatProvidersSDK'
    end
    

    Note: If you're using Objective-C, you'll need to include use_frameworks!.

  4. Run the pod install command.

  5. Create a new "Run Scripts Phase" in your target's "Build Phases".

    This script should be the last step in your project's "Build Phases". Paste the following snippet into the script text field:

    "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ChatSDK.framework/strip-frameworks.sh"
    

    This step is required to work around an App store submission bug when archiving universal binaries. Please ensure your project's VALID_ARCHS build setting does not contain i386 or x86_64 for release configuration.

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 cocoapods.org.

Adding the SDK with Carthage

Carthage is a third party dependency manager for iOS applications. For installation and usage instructions, see Installing Carthage in the Carthage readme on Github.

  1. Add the following lines to your Cartfile to import the necessary frameworks for working with the UI we provide:

    # The main Chat SDK frameworks
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/ChatSDK/ChatSDK.json" == 2.8.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/ChatProvidersSDK/ChatProvidersSDK.json" == 2.8.0
    
    # Shared Zendesk frameworks
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/MessagingSDK/MessagingSDK.json" == 3.7.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/MessagingAPI/MessagingAPI.json" == 3.7.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/CommonUISDK/CommonUISDK.json" == 5.1.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/SDKConfigurations/SDKConfigurations.json" == 1.1.6
    

    Note: If you decide to build your own UI, you will only need to add the ChatProvidersSDK to your Cartfile.

    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/ChatProvidersSDK/ChatProvidersSDK.json" == 2.8.0
    
  2. Run the carthage update command.

  3. On your target's General tab, drag each of the following frameworks from the Carthage/Build/iOS folder to the Frameworks, Libraries and Embedded Content section and embed the frameworks by selecting Embed & Sign option.

    Note: Your app's build targets must point the FRAMEWORK_SEARCH_PATHS setting to the Carthage/Build/iOS folder.

* **ChatSDK.framework**
* **ChatProvidersSDK.framework**
* **CommonUISDK.framework**
* **SDKConfigurations.framework**
* **MessagingSDK.framework**
* **MessagingAPI.framework**
  1. Create a new "Run Scripts Phase" in your app target's "Build Phases".

    This script should be the last step in your project's "Build Phases".

    Paste the following snippet into the script text field:

    "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ChatSDK.framework/strip-frameworks.sh"
    

    This step is required to work around an App store submission bug when archiving universal binaries. Please ensure your project's VALID_ARCHS build setting does not contain i386 or x86_64 for release configuration.

Adding the SDK manually

  1. Download the following ZIP files:

    # Chat provider layer framework
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/ChatProvidersSDK/2.8.0/ChatProvidersSDK.zip
    
    # Chat UI layer framework
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/ChatSDK/2.8.0/ChatSDK.zip
    
    # Shared Zendesk UI frameworks
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/MessagingSDK/3.7.0/MessagingSDK.zip
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/MessagingAPI/3.7.0/MessagingAPI.zip
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/CommonUISDK/5.1.0/CommonUISDK.zip
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/SDKConfigurations/1.1.6/SDKConfigurations.zip
    

    Note: If you decide to build your own UI, you will only need to add the ChatProvidersSDK framework. https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/ChatProvidersSDK/2.8.0/ChatProvidersSDK.zip

    You can also batch download the ZIP files by copying the above list, pasting it into a text file and running the following command:

    wget -i _the_name_of_the_file_you_created_
    

    Note: You can install the wget tool with Homebrew using brew install wget.

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

  3. In Finder, navigate to where you extracted the SDKs.

  4. Ensure a Frameworks directory exists in the top level of your project directory. Create this directory if it does not exist.

  5. Copy the following items into the Frameworks folder in your project:

* **ChatSDK.xcframework**
* **ChatProvidersSDK.xcframework**
* **CommonUISDK.xcframework**
* **SDKConfigurations.xcframework**
* **MessagingSDK.xcframework**
* **MessagingAPI.xcframework**
  1. Drag the frameworks into the Frameworks, Libraries and Embedded Content section of your project and embed the frameworks by selecting Embed & Sign option.

  2. In Build Settings set the CLANG_ENABLE_MODULES field to YES.