Adding the Unified SDK

The Unified SDK for iOS supports three methods of integration:

Adding the SDK with SPM

The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

To add a Zendesk SDK to your project as a dependency:

  1. Retrieve the URL of the desired product SDK package. Examples: https://github.com/zendesk/answer_bot_sdk_ios for AnswerBot, https://github.com/zendesk/chat_sdk_ios for Chat, or https://github.com/zendesk/support_sdk_ios for Support.

  2. Follow the Apple documentation on how to add the package to your project.

  3. Paste the URL from step 1 into the Choose repository package search bar.

  4. Use version-based Package Requirements, and set the value to the latest version of the SDK.

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:

    target 'My Sample App' do
      use_frameworks! # If you're using Objective-C, remove this line
    end
    
  4. Add one of the following pod commands to the do block of your Podfile, depending on your Zendesk configuration.

    target 'My Sample App' do
      ...
      # Unified SDK is a sub-dependency of each of the product SDK
      # pods(`ZendeskAnswerBotSDK`, `ZendeskChatSDK` and `ZendeskSupportSDK`).
    
      pod 'ZendeskAnswerBotSDK' # AnswerBot-only on the Unified SDK
      pod 'ZendeskChatSDK'      # Chat-only on the Unified SDK
      pod 'ZendeskSupportSDK'   # Support-only on the Unified SDK
    end
    
  5. Save the Podfile.

  6. Run the following command in Terminal:

    pod install
    

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

  7. (Fat framework only) Create a new "Run Scripts Phase" in your app's target's "Build Phases".

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

    bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/SupportSDK.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 another common third party dependency manager for iOS applications. For installation and usage instructions, see Installing Carthage in the Carthage readme on Github.

  1. In your Cartfile, add the following lines to import the necessary frameworks to integrate the Support, Chat and AnswerBot dependencies:

    # Core layer framework
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/ZendeskCoreSDK/ZendeskCoreSDK.json" == 2.5.0
    
    # Answer Bot SDK
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/AnswerBotSDK/AnswerBotSDK.json" == 2.1.2
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/AnswerBotProvidersSDK/AnswerBotProvidersSDK.json" == 2.1.2
    
    # Support SDK
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/SupportSDK/SupportSDK.json" == 5.2.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/SupportProvidersSDK/SupportProvidersSDK.json" == 5.2.0
    
    # Chat SDK
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/ChatSDK/ChatSDK.json" == 2.10.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/ChatProvidersSDK/ChatProvidersSDK.json" == 2.10.0
    
    # Shared Zendesk UI frameworks
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/CommonUISDK/CommonUISDK.json" == 6.1.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/MessagingSDK/MessagingSDK.json" == 3.8.1
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/MessagingAPI/MessagingAPI.json" == 3.8.1
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/SDKConfigurations/SDKConfigurations.json" == 1.1.7
    

    Note: If you only want one product SDK, simply remove the other product SDKs from this list.

  2. Save the Cartfile.

  3. Run the following command:

    carthage update
    
  4. Drag the following frameworks to the Frameworks and Libraries section under the general settings tab of your application's target. Ensure the Embed dropdown has Embed and Sign selected for each framework.

* **ZendeskCoreSDK.xcframework**
* **SupportProvidersSDK.xcframework**
* **SupportSDK.xcframework**
* **CommonUISDK.xcframework**
* **AnswerBotSDK.xcframework**
* **AnswerBotProvidersSDK.xcframework**
* **ChatSDK.xcframework**
* **ChatProvidersSDK.xcframework**
* **MessagingSDK.xcframework**
* **MessagingAPI.xcframework**
* **SDKConfigurations.xcframework**
  1. (Fat framework only) Create a new "Run Scripts Phase" in your app's target's "Build Phases".

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

    bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZendeskCoreSDK.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.

Note: Your application build target's must point its FRAMEWORK_SEARCH_PATHS setting at the Carthage/Build/iOS folder.

Manually adding the SDK

To use the Unified SDK in your app, you must add the following SDKs to your project manually in Xcode.

Note: For manual integrations, integrators have the choice of using Apple's new framework format XCFrameworks or the older fat framework format.

  1. Download the following ZIP files:

    # Core layer framework
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/ZendeskCoreSDK/2.5.0/ZendeskCoreSDK.zip
    
    # AnswerBot SDK
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/AnswerBotSDK/2.1.2/AnswerBotSDK.zip
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/AnswerBotProvidersSDK/2.1.2/AnswerBotProvidersSDK.zip
    
    # Support SDK
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/SupportSDK/5.2.0/SupportSDK.zip
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/SupportProvidersSDK/5.2.0/SupportProvidersSDK.zip
    
    # Chat SDK
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/ChatSDK/2.10.0/ChatSDK.zip
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/ChatProvidersSDK/2.10.0/ChatProvidersSDK.zip
    
    # Shared Zendesk UI frameworks
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/MessagingSDK/3.8.1/MessagingSDK.zip
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/MessagingAPI/3.8.1/MessagingAPI.zip
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/CommonUISDK/6.1.0/CommonUISDK.zip
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.3/SDKConfigurations/1.1.7/SDKConfigurations.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 SDK.

  4. Drag the following XCFrameworks to the Frameworks and Libraries section under the general settings tab of your application's target. Ensure the Embed dropdown has Embed and Sign selected for each framework.

* **ZendeskCoreSDK.xcframework**
* **SupportProvidersSDK.xcframework**
* **SupportSDK.xcframework**
* **CommonUISDK.xcframework**
* **AnswerBotSDK.xcframework**
* **AnswerBotProvidersSDK.xcframework**
* **ChatSDK.xcframework**
* **ChatProvidersSDK.xcframework**
* **MessagingSDK.xcframework**
* **MessagingAPI.xcframework**
* **SDKConfigurations.xcframework**

**Note**: Drag the `.framework` files if you prefer to use the fat framework format instead.
  1. Set the Add Files options as follows:

    • Destination - select Copy items if needed
    • Added folders - select Create groups
  2. (Fat framework only) Create a new "Run Scripts Phase" in your app's target's "Build Phases".

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

    bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZendeskCoreSDK.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.

Note: If you get link errors when building the project, you may have to add one or both of the following Apple core frameworks to your project: MobileCoreServices.framework and Security.framework. They don't always get added automatically.

Add iCloud permissions

To allow your users to attach files to support requests from their iCloud account, you must enable iCloud Documents in your apps Capabilities.

Update usage descriptions in Info.plist

The Support SDK uses the camera and photo library in iOS to allow end users to add image attachments to tickets.

If your app doesn't already request permissions for these features, update your Info.plist file with a usage description for NSPhotoLibraryUsageDescription and NSCameraUsageDescription.

Learn more about Cocoa keys in the Apple developer documentation.