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
Component | Requirement |
---|---|
OS | iOS 13 or higher. |
Software | Xcode 11.0 and aboveWebex Connect iOS SDK |
Accounts | An active Apple developer account. An active Webex Connect tenant. |
OS Version Support
SDK Version | Min Supported OS | TLS Support |
---|---|---|
3.0.0 and higher | iOS 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.
Module | Description |
---|---|
WebexConnectCore | The 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. |
WebexConnectPush | This 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. |
WebexConnectInAppMessaging | The 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:
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:
- Install CocoaPods:
gem install cocoapods
- Setup CocoaPods:
pod setup
- 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
- 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
-
To ensure that WebexConnect SDK functions properly, you need to include the EncryptedCoreData pod in
your project. Follow the steps below:- Open your project's Podfile.
- Add the following line under your target:
pod 'EncryptedCoreData', :git => '<https://github.com/project-imas/encrypted-core-data.git'>
- Run the command:
This will install the necessary EncryptedCoreData dependency for WebexConnectCore.
pod install
-
Add Custom iOS Target Properties to your project:
- Select your project within the Project Navigator.
(applicable only if you are using the
Monitor module). - Click Info.
- Click the (+) that appears when you hover the mouse over any line within the list.
- Add the following key:
To use location services or geofences, add the following keys and provide relevant descriptions:
- Privacy - Location Always and When In Use Usage Description
- Privacy - Location Always Usage Description
- Privacy - Location When In Use Usage Description
- 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.
- Select your project within the Project Navigator.
(applicable only if you are using the
-
Enable push notifications:
-
Click your project within the File Navigator.
-
Click Targets > Select Application Target > Signing & Capabilities.
-
Add Push Notifications capability.
-
-
Add required Background Modes.
-
Click your project within the File Navigator.
-
Click Targets > Select Application Target > Signing & Capabilities.
-
Add Background Modes Capability.
-
Enable Location Updates, Background fetch & Remote notifications.
-
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:
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.
Updated about 1 month ago