iOS SDK Quick Start Guide (Modular)

This document details the changes that are required to the online help portal to support the latest version of the Webex Connect iOS Core SDK with 3.0.0 release quick start Guide changes.

Prerequisites

ComponentRequirement
OSiOS 13 or higher.
SoftwareXcode 11.0 and aboveWebex Connect iOS SDK
AccountsAn active Apple developer account. An active Webex Connect tenant.

OS Version Support

SDK VersionMin Supported OSTLS Support
3.0.0 and higheriOS 13 or higher.iOS provides TLS 1.2 support. The
lowest version supported is iOS 13 and versions higher than it.

SDK Modules

Webex Connect SDK is structured into modular components, each designed to offer specific functionality. Overview of each module and its functionality to help them understand what's available and decide which modules they want to integrate into their applications.

ModuleDescription
WebexConnectCoreThe WebexConnectCore Module is the foundation of Webex Connect SDK. It provides essential functionality that all other modules depend on, including initialization, configuration, registration and shared utilities. Automatically included in the other modules.
WebexConnectPushThis WebexConnectPush module enables your application to receive and handle push notifications. It abstracts the underlying push notification service, providing a customization support for notification management.
WebexConnectInAppMessagingThe WebexConnectInAppMessaging module offers both one-way and two-way messaging capabilities for your app.

Configuration Tasks

Complete the following tasks to use Webex Connect Core SDK for your Mobile Application:

  1. Installation
  2. Project Setup
  3. Setup APNs
  4. Code Integration.

Installation

You can install Webex Connect SDKs by using any one of the following methods:

Method 1: Cocoa Pods

Assuming you already have an Xcode project, e.g. MyWebexConnectApp, for your iOS app, here are the steps to integrate the Webex Connect iOS Core SDK into your Xcode project using CocoaPods:

  1. Install CocoaPods:
gem install cocoapods
  1. Setup CocoaPods:
pod setup
  1. Create a new file, Podfile, with following content in your MyWebexConnectApp project directory:

a. Core SDK: WebexConnectCoreSDK
source 'https://github.com/CocoaPods/Specs.git'

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '13.0'
target 'MyWebexConnectApp' do
pod 'WebexConnectCore'
pod 'WebexConnectPush'
pod 'WebexConnectInAppMessaging'
end
target 'MyWebexConnectAppServiceExtension' do
pod 'WebexConnectNotificationServiceExtension'
pod 'WebexConnectPush'
end

b. Notification Service Extension : WebexConnectNotificationServiceExtension

target 'MyWebexConnectAppServiceExtension' do
platform :ios, '13.0'
pod 'WebexConnectNotificationServiceExtension'
end
  1. Install the Webex Connect iOS Core SDK from your MyWebexConnectApp project directory:
pod install

Method 2: Swift Package Manager

To Integrating the iOS SDK with Swift Package Manager. Please click on the link for detailed steps.

Method 3: Manual Installation

Manual Integration by Downloading Modules from the GitHub Repository. Please click on the link for detailed steps.

Project Setup

  1. To ensure that WebexConnect SDK functions properly, you need to include the EncryptedCoreData pod in
    your project. Follow the steps below:

    1. Open your project's Podfile.
    2. Add the following line under your target:
       pod 'EncryptedCoreData', :git => '<https://github.com/project-imas/encrypted-core-data.git'>
      
    3. Run the command:
      pod install
      
      This will install the necessary EncryptedCoreData dependency for WebexConnectCore.
  2. Add Custom iOS Target Properties to your project:


    1. Select your project within the Project Navigator.
(applicable only if you are using the
      Monitor module).
    2. Click Info.

    3. Click the (+) that appears when you hover the mouse over any line within the list.

    4. Add the following key:
To use location services or geofences, add the following keys and provide relevant descriptions:
      1. Privacy - Location Always and When In Use Usage Description
      2. Privacy - Location Always Usage Description
      3. Privacy - Location When In Use Usage Description
      4. Location Services
        To enable location services regardless of whether your app is in use, add the first two keys.
To enable location services only when your app is in use, add the 3rd key.
  3. Enable push notifications:


    1. Click your project within the File Navigator.


    2. Click Targets > Select Application Target > Signing & Capabilities.

    3. Add Push Notifications capability.

      Follow the steps to add Push dependencies.

      Adding Push notifications

  4. Add required Background Modes.


    1. Click your project within the File Navigator.

    2. Click Targets > Select Application Target > Signing & Capabilities.


    3. Add Background Modes Capability.


    4. Enable Location Updates, Background fetch & Remote notifications.

      Enabling options for Background Modes

      Enabling options for Background Modes

Setup APNS

Please follow the link for setting up the APNS.

Configuring iOS .p8 Key for Token-Based Connection to APNs

Please follow the link for setting up the iOS .p8 Key for Token-Based Connection to APNs.

Code Integration

Follow the steps below to integrate the iOS Webex Connect SDK within your application:

  1. Create WebexConnectConfig.plist
  2. Initialize the SDK
  3. Register a device

Create WebexConnectConfig.plist

Within your Xcode project, create a new plist file named WebexConnectConfig.plist and copy the following
snippet into the file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-
1.0.dtd">
<plist version="1.0">
	<dict>
		<key>appId</key>
		<string>Your Application ID</string>
		<key>clientKey</key>
		<string>Your Client Key</string>
		<key>environment</key>
		<string></string>
		<key>serverDomain</key>
		<string></string>
		<key>groupIdentifier</key>
		<string>your group identifier</string>
	</dict>
</plist>
Ensure you set the appId and clientKey values to those that you generated earlier in this guide.

Ensure you set the appId and clientKey values to those that you generated earlier in this guide.

📘

Note

Add the following key/value pair in your plist, if you want to configure your server domain to override the zero-rating domain.

<key>serverDomain</key>  
<string>Your server domain</string>

Initialize the SDK

The SDK must be initialized before attempting to use any of its features.

private let webexConnect = WebexConnectProvider.instance
webexConnect.startup { error in
  if error == nil {
    print("SDK started successfully")
  } else {
    print("Error starting up the SDK: \(error)")
  }
}
id<WebexConnect> webexConnect = [WebexConnectProvider instance];
[webexConnect startupWithCompletionHandler:^(NSError* error) {
  if (error == nil) {
    NSLog(@"SDK started");
  } else {
    NSLog(@"Startup failed: %@", error.localizedDescription ?: @"");
  }
}];

Register a device

The user's device must be registered with the Webex Connect platform before other features can be used. To register a device with the platform, create an DeviceProfile instance and invoke the register method in WebexConnect.

A device profile must always have a unique device id and user id, if you do not supply a user id then the platform will assign one for you. Typically, you will want to supply your own user ID value that corresponds to a user within your backend systems.

The following snippet shows how to create and register a device profile.

private let webexConnect = WebexConnectProvider.instance
var deviceProfile = DeviceProfile(deviceId: DeviceProfile.defaultDeviceId(), userId: "your user id")
webexConnect.register(with: deviceProfile) { response, error in
  if error != nil {
    //Device registration failed, query error for reason information
  } else {
    //Device registered successfully
  }
}
id<WebexConnect> webexConnect = [WebexConnectProvider instance];
DeviceProfile *deviceProfile = [[DeviceProfile alloc] initWithDeviceId:[DeviceProfile defaultDeviceId] userId:@”userID”];
[webexConnect registerWithDeviceProfile:deviceProfile completion:^(id response, NSError *error) { 
NSLog(@"Register response: %@, error: %@", response ?: @"nil", error.localizedDescription ?: @"nil);
}];

SDK integration is now complete. To start using Push Messaging, please refer to our Push Messaging Guide and for In-App Messaging, please refer to our In-App Messaging Guide.