[Must do] Initialize the SDK

This is the developer guide for the Support SDK v1 for iOS. For Support SDK v2, see Support SDK v2 iOS.

Before you can initialize and use the Support SDK, ensure that you have already configured your app in Zendesk Support and integrated the SDK.

When you initialize the Support SDK you make it ready for use in your app. It sets initial values and performs other setup tasks. This is required for the features of the Support SDK to work.

Using Fabric

Follow the installation instructions for the Zendesk kit on the Fabric website or in the macOS app. This ensures the credentials you need for initialization are stored. You'll be guided on how to initialize the Support SDK during the installation process.

Other installs

Get the initialization code

When the app was configured in Zendesk Support, Swift and Objective-C code snippets were provided. You'll need the code snippet to initialize the Support SDK.

The initialization code snippets look like this:

Swift 3

ZDKConfig.instance().initialize(withAppId:"1e41a02a5f85d58e009ed4fa",   zendeskUrl:"https://omniwear.zendesk.com" ,     clientId:"mobile_sdk_client_e1c4e6262f1d02f43496")

Objective-C

[[ZDKConfig instance] initializeWithAppId:@"1e41a096a8cd8e009ea4fa"
    zendeskUrl: @"https://omniwear.zendesk.com"
    clientId: @"mobile_sdk_client_e1c4e6262f1d02f43496"];
Add the initialization code to your app

Use the application delegate to initialize the SDK when the application launches.

  1. Import the ZendeskSDK framework into the AppDelegate file in your project.

    Swift 3

    import ZendeskSDK
    

    Objective-C

    #import <ZendeskSDK/ZendeskSDK.h>
    
  2. Paste the initialization code into the application method with the didFinishLaunchingWithOptions argument.

    Swift 3

    ZDKConfig.instance().initialize(withAppId:"1e41a02a5f85d58e009ed4fa",       zendeskUrl:"https://omniwear.zendesk.com" ,         clientId:"mobile_sdk_client_e1c4e6262f1d02f43496")
    

    Objective-C

    [[ZDKConfig instance] initializeWithAppId:@"1e41a096a8cd8e009ea4fa"
        zendeskUrl: @"https://omniwear.zendesk.com"
        clientId: @"mobile_sdk_client_e1c4e6262f1d02f43496"];
    

If the Help Center has a host-mapped address, then use the host-mapped URL rather than the default https://{subdomain}.zendesk.com URL.

Changing the Zendesk Support brand

Every Zendesk Support account has one brand by default. Some accounts have additional brands. See the Zendesk Support brand decision in the SDK integration checklist.

If your account only has a single brand, you don't have to do anything. Out of the box, the SDK displays the brand's Help Center and submits tickets marked with the brand name.

If your account has multiple brands and you want the SDK to work with another brand, replace the zendeskUrl value in the initialization code with the brand's URL. For example, if you want the SDK to work with the obscurat brand instead of the default omniwear brand, replace https://omniwear.zendesk.com with https://obscurat.zendesk.com as the value of zendeskUrl:

Swift 3

ZDKConfig.instance().initialize(withAppId:"1e41a02a5f85d58e009ed4fa",   zendeskUrl:"https://obscurat.zendesk.com" ,     clientId:"mobile_sdk_client_e1c4e6262f1d02f43496")

Objective-C

[[ZDKConfig instance] initializeWithAppId:@"1e41a096a8cd8e009ea4fa"
     zendeskUrl: @"https://obscurat.zendesk.com"
     clientId: @"mobile_sdk_client_e1c4e6262f1d02f43496"];

If you are using Fabric, change the url in the info.plist file that contains your Fabric settings.

The application and client ids remain unchanged.