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 the Support Help Center.

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 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
      use_frameworks!
    end
    
  4. If you're using Objective-C, comment out use_frameworks!.

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.

  4. 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 build version 5.0.0 of the Support SDK:

    # Core layer framework
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/ZendeskCoreSDK/ZendeskCoreSDK.json" == 2.3.0
    
    # Support SDK
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/SupportSDK/SupportSDK.json" == 5.0.5
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/SupportProvidersSDK/SupportProvidersSDK.json" == 5.0.5
    
    # Shared Zendesk UI frameworks
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/CommonUISDK/CommonUISDK.json" == 5.0.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/MessagingSDK/MessagingSDK.json" == 3.6.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/MessagingAPI/MessagingAPI.json" == 3.6.0
    binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/SDKConfigurations/SDKConfigurations.json" == 1.1.5
    

    Note: If you only want Support API providers with no UI, simply remove the SupportSDK and all of the shared Zendesk UI frameworks 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.framework
    • SupportProvidersSDK.framework
    • SupportSDK.framework
    • CommonUISDK.framework
    • MessagingSDK.framework
    • MessagingAPI.framework
    • SDKConfigurations.framework
  5. Create a new "Run Scripts Phase" in your app 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.

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.

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

Swift: Adding the Support SDK manually in Xcode

  1. Download the following ZIP files:

    # Core layer framework
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/ZendeskCoreSDK/2.4.1/ZendeskCoreSDK.zip
    
    # Support provider layer framework
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/SupportProvidersSDK/5.1.0/SupportProvidersSDK.zip
    
    # Support UI layer framework
    https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/5.2.4/SupportSDK/5.1.0/SupportSDK.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
    

    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
    • MessagingSDK.xcframework
    • MessagingAPI.xcframework
    • SDKConfigurations.xcframework

    Note: Drag the .framework files if you prefer to use the fat framework format instead.

  5. Set the Add Files options as follows:

    • Destination - select Copy items if needed
    • Added folders - select Create groups
  6. (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.

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

    Note: Drag the .framework files if you prefer to use the fat framework format instead.

  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.

  11. (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.

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.