Adding the Unified SDK

The Unified SDK for iOS supports four 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:

```rubytarget 'My Sample App' do  use_frameworks! # If you're using Objective-C, remove this lineend```
  1. 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 SDKend
  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 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 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:

    # Answer Botgithub "zendesk/answer_bot_sdk_ios" ~> 5.0.0# Chatgithub "zendesk/chat_sdk_ios" ~> 5.0.0# Supportgithub "zendesk/support_sdk_ios" ~> 8.0.0

    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 --use-xcframeworks
  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

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:

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`.
  1. In Xcode, select your project in Project navigator:

  2. In Finder, navigate to where you extracted the SDK.

  3. 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
  4. Set the Add Files options as follows:

    • Destination - select Copy items if needed
    • Added folders - select Create groups

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.