Adding the Unified SDK
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:
-
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.
-
Follow the Apple documentation on how to add the package to your project.
-
Paste the URL from step 1 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 one of the following
pod
commands to thedo
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 SDK
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
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 integrate the Support, Chat and AnswerBot dependencies:
# Answer Bot
github "zendesk/answer_bot_sdk_ios" ~> 6.0.0
# Chat
github "zendesk/chat_sdk_ios" ~> 5.0.5
# Support
github "zendesk/support_sdk_ios" ~> 9.0.0
Note: If you only want one product SDK, simply remove the other product SDKs from this list.
-
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
- 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.
- Download the following ZIP files:
- https://github.com/zendesk/core_sdk_ios/releases/download/5.0.5/ZendeskCoreSDK.xcframework.zip
- https://github.com/zendesk/answer_bot_sdk_ios/releases/download/6.0.0/AnswerBotSDK.xcframework.zip
- https://github.com/zendesk/answer_bot_providers_sdk_ios/releases/download/6.0.0/AnswerBotProvidersSDK.xcframework.zip
- https://github.com/zendesk/support_sdk_ios/releases/download/9.0.0/SupportSDK.xcframework.zip
- https://github.com/zendesk/support_providers_sdk_ios/releases/download/9.0.0/SupportProvidersSDK.xcframework.zip
- https://github.com/zendesk/chat_sdk_ios/releases/download/5.0.5/ChatSDK.xcframework.zip
- https://github.com/zendesk/chat_providers_sdk_ios/releases/download/5.0.5/ChatProvidersSDK.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
- https://github.com/zendesk/sdkconfigurations_sdk_ios/releases/download/4.0.1/SDKConfigurations.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 using `brew 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
- AnswerBotSDK.xcframework
- AnswerBotProvidersSDK.xcframework
- ChatSDK.xcframework
- ChatProvidersSDK.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.
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.