Support SDK for iOS in a nutshell
Support SDK for iOS in a nutshell
This page gives you the basic steps for getting up and running with the Support SDK.
The SDK has the following requirements:
- Minimum iOS version: 12
- Support 5.0.3 and newer is built with XCode 11.4+ and Swift 5.2.2
What is the Support SDK?
The Support SDK helps you add the following features to your app:
- Show all or some help center content
- Search help center content
- Show open requests
- Create requests
- Update requests
You can customize the colors and fonts of the user interface with the Support SDK for all of these features. For more information, see customizing the look.
You can also use the functionality of the Support SDK without the provided UI. This allows you to build your own UI. This takes a little more development time but gives you more control. Find out about API providers on top of which you can build your own UI.
What you need
-
Your organization has a Zendesk Support account. You can register to start a free trial.
-
A Zendesk admin has registered your iOS app in Zendesk Support. See Registering the mobile app in Zendesk Support in Zendesk help
-
The Zendesk admin has provided you with the initialization code for the app. The code was generated in Zendesk Support when the admin registered the app
-
The features you want to use are included in your Zendesk plan. See the breakdown of features and limitations per plan.
Getting up and running
-
Add the SDK to your project.
For details, see Adding the Support SDK.
-
Initialize the SDK in the AppDelegate file of your project. This is a two-step process. First, you initialize the Core SDK, then you initialize the Support SDK.
Swift
Zendesk.initialize(appId: "appId", clientId: "clientId", zendeskUrl: "url")
Support.initialize(withZendesk: Zendesk.instance)
Objective-C
[ZDKClassicZendesk initializeWithAppId:"appId" clientId:"clientId" zendeskUrl:"url"];
[ZDKSupport initializeWithZendesk:[ZDKClassicZendesk instance]];
If you're only using the API providers and building the UI yourself:
Swift
Zendesk.initialize(appId: "appId", clientId: "clientId", zendeskUrl: "url")
Support.initialize(withZendesk: Zendesk.instance)
Objective-C
[ZDKClassicZendesk initializeWithAppId:"appId" clientId:"clientId" zendeskUrl:"url"];
[ZDKSupport initializeWithZendesk:[ZDKClassicZendesk instance]];
Note: If you're using multiple brands you can use a brand subdomain rather than the primary subdomain in the
zendeskUrl
in the code above. Keep in mind that the end user will only be able to view tickets that belong to that brand. -
Create an identity so the app can authenticate as a Zendesk Support user, then set it on the
Zendesk
singleton:Swift
let ident = Identity.createAnonymous()
Zendesk.instance?.setIdentity(ident)
Objective-C
id<ZDKObjCIdentity> userIdentity = [[ZDKObjCAnonymous alloc] initWithName:nil email:nil];
[[ZDKClassicZendesk instance] setIdentity:userIdentity];
There are two types of identity: anonymous and JWT. For details, see Setting an identity.
The Support SDK is now initialized and ready for use.
Launching the Support SDK UI
The Support SDK provides 4 view controllers:
- HelpCenterOverviewViewController
- HelpCenterArticleViewController
- RequestViewController
- RequestListViewController
These UIViewControllers are returned by RequestUi
and ZDKHelpCenterUi
. They can be presented in any way but must be contained in a UINavigationController. Example:
Swift
let viewController = RequestUi.buildRequestUi(with: [])
self.navigationController?.pushViewController(viewController, animated: true)
Objective-C
UIViewController *requestList = [ZDKRequestUi buildRequestUiWith:@[]];
[self.navigationController pushViewController:requestList animated:YES];
They can be configured using RequestUiConfiguration
and ZDKHelpCenterUI
. Example:
Swift
//Create a configuration object
let config = RequestUiConfiguration()
config.subject = "Testing the SDK"
config.tags = ["ios", "testing"]
//Present the SDK
let requestScreen = RequestUi.buildRequestUi(with: [config])
self.navigationController?.pushViewController(requestScreen, animated: true)
Objective-C
//Create a configuration object
ZDKRequestUiConfiguration * config = [[ZDKRequestUiConfiguration alloc] init];
config.tags = @[@"Create Request"];
config.subject = @"Test from create request";
//Present the SDK
UIViewController *requestScreen = [ZDKRequestUi buildRequestUiWith:@[config]];
[self.navigationController pushViewController:requestScreen animated:YES];
You can pass one screen's Configuration
to another screen, to be applied if one of them starts the other. For details, see Configuring the SDK activities.
To see some samples of different ways to use the Zendesk mobile SDKs, have a look at our sample apps repo on Github.