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 admin access to Zendesk Support, sign in and go to Admin > 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 ZendeskSDK
    import ZendeskCoreSDK
    

    Objective-C

    @ import ZendeskSDK
    @ import ZendeskCoreSDK
    

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

    Swift

    import ZendeskProviderSDK
    import ZendeskCoreSDK
    

    Objective-C

    @ import ZendeskProviderSDK
    @ 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")
    SupportUI.initialize(withZendesk: Zendesk.instance)
    

    Objective-C

    [ZDKZendesk initializeWithAppId:@"appId" clientId:@"clientId" zendeskUrl:@"url"];
    [ZDKSupportUI initializeWithZendesk:[ZDKZendesk 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

    [ZDKZendesk initializeWithAppId:@"appId" clientId:@"clientId" zendeskUrl:@"url"];
    [ZDKSupport initializeWithZendesk:[ZDKZendesk 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.

This initializes the Core SDK and the Support SDK.

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