Initializing the Support SDK (Required)

Initialize the Support SDK in the AppDelegate file when your application is launched.

Prerequisites

Getting the initialization settings

You need the following information to initialize the SDK:

  • the URL of your Zendesk Support instance
  • your app's id in Zendesk Support
  • the client id of your app in Zendesk Support

The settings were generated in Zendesk Support when the Zendesk admin registered your app:

init settings

If you have access to Admin Center, sign in and go to Channels > Classic > Mobile SDK. If you don't have admin access, ask a Zendesk admin to get the information for you.

If your organization's help center has a host-mapped address, then use the host-mapped URL instead of the Zendesk URL.

Adding the initialization code

  1. Import the following frameworks into the AppDelegate file in your project.

    Swift

    import SupportSDKimport ZendeskCoreSDK

    Objective-C

    @ import SupportSDK@ import ZendeskCoreSDK

    If you're only using the API providers and building the UI yourself:

    Swift

    import SupportProvidersSDKimport ZendeskCoreSDK

    Objective-C

    @ import SupportProvidersSDK@ import ZendeskCoreSDK
  2. Paste the following initialization code into the application method with the didFinishLaunchingWithOptions argument.

    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]];

    Replace the parameter placeholders with your initialization settings.

    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.

This initializes the Core SDK and the Support SDK.

The next step is to set an identity. See Setting an identity for more details.