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 'ZendeskSDK'
    end
    

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

    target 'My Sample App' do
      ...
      pod 'ZendeskSDK/Providers'
    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 ZendeskSDK 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}/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.

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.

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 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. Drag the following items into the Embedded Binaries section of your project.

    • ZendeskCoreSDK.framework
    • ZendeskProviderSDK.framework
    • ZendeskSDK.framework
    • ZendeskSDKStrings.bundle

    To install only the API providers and build the UIs yourself, you can leave out ZendeskSDK.framework.

  5. Set the Add Files options as follows:

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

    Note: Ensure that ZendeskSDKStrings.bundle destination is set to "Resources" in your targets "Build Phases".

  6. 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.framework
    • ZendeskProviderSDK.framework
    • ZendeskSDK.framework
    • ZendeskSDKStrings.bundle
  6. Drag these items into the Embedded Binaries section of your project.

  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

    Note: Ensure that ZendeskSDKStrings.bundle destination is set to "Resources" in your targets "Build Phases".

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

Add iCloud permissions

To allow your users to attach files to support requests, 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.