iOS SDK

This section describes:

Downloading iOS SDK

Before performing any setup, download and integrate the SDK with your project.
To download the SDK, follow the steps given below:

  1. In the channel screen, click iOS SDK.
    The iOS SDK screen will be displayed
  2. Click the Download SDK tab and then click the iOS icon.
    The latest compatible iOS SDK version zip file will be downloaded.
960
  1. Interage your application with Session AI's iOS SDK

πŸ“˜

Note:

The download SDK zip file contains .h and .a files for iOS devices and simulators. It also contains a sample app.


Generating iOS API Key

The API key generated from any channel is valid only for that particular channel.
To generate an iOS API key, follow the steps given below:

  1. In the iOS SDK screen, click the API Keys tab.
  2. Click the GENERATE API KEY located in the upper-right corner.
    A new API key with the system-generated name will be displayed.
1429

πŸ“˜

Note:

  • A newly created API key will be in an Active state.
  • To deactivate the API key, click the Deactivate button.
  • To delete the API key, click the Delete button.
  • To copy the API key, click Copy API Key.
  1. To change the name of an API key, click the system-generated API name.
    The API Key dialog box will be displayed.
  2. Enter the unique name in the Application Name field.
  3. Click OK. The API key will be renamed.
621

Configuring iOS SDK

Configuring the SDK allows you to track the geolocations of the customers and return when they enter and exit the geofence that you defined in the Session AI platform.

To set Geofence location, refer to the Add and Manage a Location Channel

If the geofence locations are defined in the C3, and settings are configured, then Google asks the customer for location services permission. Once the app is given access to location services, the SDK starts the Google API client to track geofencing.
When the customer enters or exits a geofence region, SDK notifies the Cloud, and then it set into motion for any predefined rules for this event.

You can configure the following Geolocation services:

  • Fine Location: Provides location services from GPS and network location providers available on the device with higher accuracy.
  • Coarse Location: Provides location services using Google's GeoLocation API. If a customer has not been permitted to access the application's fine location, you can enable the coarse location permissions.

To configure the geolocation service, follow the steps given below:

  1. In the iOS SDK screen, click the SDK Configuration tab.
  2. Enter an appropriate time in minutes for *How often should the SDK check for configuration changes?** to check for configurations made in Manage Tags, SDK Configuration, and SDK Properties.
  3. Enable the Allow SDK to collect user's location toggle to track the customer's fine location.
1421
  1. Enable the Allow SDK to collect coarse location in case the user has not given permission to collect their fine location toggle to collect the coarse location even if the customer has not allowed accessing their fine location.
  • Enter your Google's GeoLocation API key in the Provide API key for Google Location API field.
  • Enter appropriate time as per selected duration unit in How often should the SDK check the user's location.
  1. Click Save.
1428

πŸ“˜

iOS Location Services

  • Session AI iOS SDK uses significant location changes as recommended by Apple Inc. For more information, refer iOS Location Services topic.
    • SDK sends updates based on significant location changes provided by iOS. Furthermore, an update is sent only if the time elapsed since the last update is more than the threshold set in C3.
    • iOS SDK sends the coarse location only when app location permission is not granted and the app is in the foreground.

Managing iOS SDK Tags

Session AI platform provides the Tag Management feature that enables dynamic instrumentation of events in your channel application without changing the application code or redeploying it.

A tag is a code snippet that is sent to the channel application and activated on a defined triggering event in the application, such as a page load/unload. When the event is triggered in the channel application, the tag defined for that trigger is executed, and it sends its event payload to Cloud.

To create iOS SDK tags, follow the step given below:

  1. In the iOS SDK screen, click Manage Tags.
  2. In the Manage Tags tab, click the Create a new Tag.
1423

The settings to create a new tag screen will be displayed.
3. Provide the following details:

  • Tag Name: Enter the unique tag name which allows you to identify this tag.
  • Tag Trigger: It defines "when" the SDK should execute this tag on the device. The system allows you to create the following types of Tag Triggers:
    • On Click: On-click tag trigger is applicable on UI button elements. Specify the UIButton Element by Tittle or by Tag and enter the value assigned to that button. Select All UIViewControllers options for the assigned button or specify the controller by ClassName of the required page.
    • On Value Changed: This trigger is applicable to the value change of any UITextField or UITextView element. Provide an appropriate path to identify the UITextField/UITextView Element through a tag.
    • On UIViewController Load: This tag executes when the specific UIViewController or all UIViewController loads. Select the All UIView option or specify the Class Names of the required page.
    • On UIViewController Unload: This tag executes when the specific UIViewController or all UIViewController unloads. Select the All UIView option or specify the Class Names of the required page.
    • On Call: This tag trigger executes when the specified Method is called from a particular Class or list of classes.
    • On Value Changed in Data Layer: This tag trigger can be used when the developer wants to trigger the tag on a change of a variable added to the Session AI data layer. This addition is done using the aforementioned API.
      [Session AI addData:@"param_name" withValue:param_value];
  • Tag Action: The type of action, SDK will take when executing the selected tag type. Select Send event to Session AI Cloud. In the Tag Payload section, enter the following details:
    • Event Name: Enter the appropriate event name. Click Add More to add the Event Parameters for the selected event.
  1. Click Save
1773

πŸ“˜

Information

  • When the developer adds a variable called loginTime to the data layer, and if the trigger is set up to track that variable, it fires whenever it changes.
  • The developer must provide the variable name, loginTime while creating the tag. The developer can also track multiple variables with one tag by providing a pipe-separated list of variables.
    For example, "loginTime|logoutTime".

The newly added tag appears in the list of tags.
5. To publish all active tags, click Publish Tags located in the upper-right corner.
Once published, it's delivered to the native application whenever the SDK connects to the Session AI server.

1424

πŸ“˜

Note:

  • By default, the status of the newly created tag is Active.
  • icon indicates that the tag is not published. Publish a tag to deliver it to the integrated native application.
  • To copy the content of a tag, click the Copy icon.
  • Click the Delete icon to delete the tag permanently. Tags marked with this icon are deleted tags. Click Publish Tags to remove the deleted tag from the system.

Configuring iOS SDK Properties

Session AI provides various out-of-the-box properties that can be used to configure the iOS SDK.

For more information about the iOS SDK properties, refer to the iOS SDK Properties in Session AI Developer's Guide.

The Session AI platform allows you to set values for the desired properties of the iOS SDK to match your app design and requirements. Configure display settings for messages.

To configure display settings for messages, follow the step given below:

  1. In the iOS SDK screen, click SDK Properties.
    The screen displays the following settings.
  2. Under Select an SDK property from the drop-down and assign a value, perform the following:
  • Property: Select the appropriate property name.
  • Property Value: Enter the appropriate property value.
  • Click the Add to add the property and its value.
    The screen displays the newly added property.
  1. Click Save to set the changes.
1422