Adding the Support SDK (Required)
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:
-
Follow the Apple documentation on how to add the package to your project.
-
Paste the Support SDK package URL, https://github.com/zendesk/support_sdk_ios, into the Choose repository package search bar.
-
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:
-
In Terminal, navigate to the top-level folder of your project (the one with the xcodeproj file).
-
Create a Podfile with the following command:
$ pod init
-
Open the file in Xcode with the following command:
open -a Xcode Podfile
The content should look as follows:
```ruby
target 'My Sample App' do
use_frameworks! # If you're using Objective-C, remove this line
end
```
Add the Zendesk Support SDK to your Podfile and install the Support SDK in your project as follows:
-
Add
pod 'ZendeskSDK'
to thedo
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
-
Save the Podfile.
-
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.
-
In your cartfile, add the following lines to import the necessary frameworks to build version 8.0.2 of the Support SDK:
github "zendesk/support_sdk_ios" ~> 9.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" ~> 9.0.0
-
Save the cartfile.
-
Run the following command:
carthage update --use-xcframeworks ```
- Drag the following frameworks to the Frameworks and Libraries section under the general settings tab of your application's target. Ensure the
Embed
dropdown hasEmbed 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
- Download the following ZIP files:
-
https://github.com/zendesk/core_sdk_ios/releases/download/5.0.5/ZendeskCoreSDK.xcframework.zip
-
https://github.com/zendesk/support_sdk_ios/releases/download/9.0.0/SupportSDK.xcframework.zip
-
https://github.com/zendesk/messaging_sdk_ios/releases/download/6.0.3/MessagingSDK.xcframework.zip
-
https://github.com/zendesk/messagingapi_sdk_ios/releases/download/6.0.2/MessagingAPI.xcframework.zip
-
https://github.com/zendesk/commonui_sdk_ios/releases/download/9.0.3/CommonUISDK.xcframework.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 usingbrew install wget
.
-
In XCode, select your project in Project navigator:
-
In Finder, navigate to where you extracted the SDK.
-
Drag the following XCFrameworks to the Frameworks and Libraries section under the general settings tab of your application's target. Ensure the
Embed
dropdown hasEmbed and Sign
selected for each framework.- ZendeskCoreSDK.xcframework
- SupportProvidersSDK.xcframework
- SupportSDK.xcframework
- CommonUISDK.xcframework
- MessagingSDK.xcframework
- MessagingAPI.xcframework
- SDKConfigurations.xcframework
-
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
-
Download the ZIP file from the Zendesk Support SDK repo on Github and unzip the file on your hard drive.
-
In XCode, select your project in Project navigator.
-
In Finder, navigate to where you extracted the SDK.
-
Ensure there is a Frameworks directory in the top level of your project directory. Create this directory if it does not exist.
-
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
-
Drag these items into the Frameworks and Libraries section and ensure the
Embed
dropdown hasEmbed and Sign
selected for each of them. -
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
-
In your projects Build Settings, search for FRAMEWORK_SEARCH_PATHS. Add your projects Frameworks folder. You can simply drag the folder in from Finder.
-
In Build Settings, search for CLANG_ENABLE_MODULES. Set this field to Yes.
-
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.