Adding the Support SDK (Required)

Before adding the Support SDK to your iOS project, make sure a Zendesk Support administrator has registered your app in Zendesk Support. See Registering the application in Zendesk Support in Zendesk help.

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

The Support SDK uses the camera and photo library in iOS to let end users add image attachments to tickets. Whatever method you choose to add the SDK, also check the usage descriptions in the info.plist file for camera and photo library access.

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 the Support SDK to your project as a dependency:

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

  2. Paste the Support SDK package URL, https://github.com/zendesk/support_sdk_ios, into the Choose repository package search bar.

  3. 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```

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

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

    target 'My Sample App' do  ...  pod 'ZendeskSupportSDK'end

    To install only the API providers and build the UIs yourself:

    target 'My Sample App' do  ...  pod 'ZendeskSupportProvidersSDK'end
  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 ZendeskSupportSDK 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 build version 8.0.0 of the Support SDK:

    github "zendesk/support_sdk_ios" ~> 8.0.0

    Note: If you only want Support API providers with no UI, you will only need to add the SupportProvidersSDK to your Cartfile.

    github "zendesk/support_providers_sdk_ios" ~> 8.0.0
  2. Save the cartfile.

  3. Run the following command:

carthage update --use-xcframeworks ```

  1. 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
    • 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 Support SDK in your app, you must add the Zendesk Support SDK to your project manually in Xcode. The instructions differ depending on whether you're using Swift or Objective-C.

Swift: Adding the Support SDK manually in Xcode

  1. Download the following ZIP files:
  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
    • 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.

Objective-C: Adding the Support SDK manually in Xcode

  1. Download the ZIP file from the Zendesk Support SDK repo on Github and unzip the file on your hard drive.

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

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

  4. Ensure there is a Frameworks directory 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.

    • ZendeskCoreSDK.xcframework
    • SupportProvidersSDK.xcframework
    • SupportSDK.xcframework
    • CommonUISDK.xcframework
    • MessagingSDK.xcframework
    • MessagingAPI.xcframework
    • SDKConfigurations.xcframework
  6. Drag these items into the Frameworks and Libraries section and ensure the Embed dropdown has Embed and Sign selected for each of them.

  7. Set the rest of the Add Files settings 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
  8. In your projects Build Settings, search for FRAMEWORK_SEARCH_PATHS. Add your projects Frameworks folder. You can simply drag the folder in from Finder.

  9. In Build Settings, search for CLANG_ENABLE_MODULES. Set this field to Yes.

  10. In Build Settings, search for ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES. Set this field to Yes.

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. Note that users must allow both in order for any image attachments to be sent.

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.