Get Started
Before you get started: Make sure you have created a channel in OneTalk dashboard and obtain the APP_KEY_SECRET.

Configure and Initialize TapTalk.io Omnichannel iOS SDK

Step 1: Install TapTalk.io Omnichannel iOS SDK

  1. 1.
    You can install the TapTalk.io Omnichannel iOS SDK using CocoaPods like the following. If you are new to CocoaPods, you can see more information in Cocoapods guides. To create a Podfile, open a terminal window, navigate to your project directory, and then create a Podfile by running the following command in the terminal:
1
$ pod init
Copied!
Then Podfile will be created in your project directory. Open the Podfile and add the following lines to the Podfile.
1
# Please make sure you define platform on your Podfile
2
# Make sure to use ios 11.0 for minimum deployment target
3
4
platform :ios, '11.0'
5
use_modular_headers!
6
7
target "YourProjectName" do
8
9
...
10
11
pod 'TapTalkLive'
12
13
end
Copied!
Note: For SDK version 1.1.0 and above, use_frameworks! is replaced with use_modular_headers! to handle some compatibility issues.
For versions below 1.1.0, please replace use_modular_headers! on the code above with use_frameworks!
Note: Please make sure you implement ios version 11.0platform :ios, '11.0' for minimum deployment target to obtain latest update of TapTalk.io SDK
Since TapTalk.io use uses git-lfs (Git Large Files Storage) you will need to install GIT LFS to clone/install TapTalk.io SDK through Cocoapods.
Note: Make sure to install git-lfsbefore pod install, otherwise the pod install / pod update will be error
Easiest way to install git-lfs is using brew:
Terminal
1
brew install git-lfs
2
git lfs install
Copied!
Next, after the git-lfs is installed, install the TapTalk.io through CocoaPods.
1
$ pod install
Copied!

Step 2: Grant permission in your application project

To make sure TapTalk.io Omnichannel iOS have all permission to access user's media, file, location, and contact, the application needs to ask for permissions. Go to your info.plist, and add the following key-value pairs.
Information Property Key
Information Property Value
Privacy - Camera Usage Description
$(PRODUCT_NAME) needs to request access to your camera to take profile picture and to send image chat.
Privacy - Contacts Usage Description
$(PRODUCT_NAME) need your permission to access your contact, we will sync your contact to our server and automatically find your friend so it is easier for you to find your friends.
Privacy - Photo Library Additions Usage Description
$(PRODUCT_NAME) needs to request access to your photo library to save photo.
Privacy - Photo Library Usage Description
$(PRODUCT_NAME) needs to request access to your photo library to take profile picture and to send image chat.
Privacy - Location When In Use Usage Description
$(PRODUCT_NAME) needs to request access to your location to send location chat.
Note: You can change Information Property Value based on your own preferences. These values will appear when the application requests permission from the user.
Adding new key in info.plist
Adding new key in info.plist

Step 3: Enable background modes

Background modes is required to handle background process in TapTalk.io. It is used to run some processes in the background before the app is killed. For more information about the processes, check out the background process section.
To enable background modes, go to Target -> Capabilities, then turn Background Modes toggle to ON, next select Background fetch and Remote notifications
After you turn on the Background Modes, Required background modes key will be added automatically in your Info.plist as shown below.

Step 4: Initialize TapTalk.io Omnichannel Application Delegate

To allow the iOS SDK to respond to the connection and state changes in your iOS client app, you have to implement all of our application delegate methods in your UIApplicationDelegate methods in appDelegate file.
After you initialize the TapTalk.io Omnichannel, you have to connect and implement these methods in your UIApplicationDelegate methods in appDelegate file to make sure TapTalk.io Omnichannel runs smoothly in your application.
TapTalk.io Omnichannel Application Delegate Method
Description
application:didFinishLaunchingWithOptions:
Tells the delegate that the launch process is almost done and the app is almost ready to run.
applicationWillResignActive:
Tells the delegate that the app is about to become inactive.
applicationDidEnterBackground:
Tells the delegate that the app is now in the background.
applicationWillEnterForeground:
Tells the delegate that the app is about to enter the foreground.
applicationDidBecomeActive:
Tells the delegate that the app has become active.
applicationWillTerminate:
Tells the delegate when the app is about to terminate.
handleException:
Tells the delegate when application throws exception.
AppDelegate.m
1
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
2
3
//Implement TapTalk Omnichannel didFinishLaunchingWithOptions here
4
[[TapTalkLive sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
5
6
//Other code
7
...
8
...
9
10
return YES;
11
}
Copied!
AppDelegate.m
1
- (void)applicationWillResignActive:(UIApplication *)application {
2
3
//Implement TapTalk Omnichannel applicationWillResignActive here
4
[[TapTalkLive sharedInstance] applicationWillResignActive:application];
5
6
//Other code
7
...
8
...
9
}
Copied!
AppDelegate.m
1
- (void)applicationDidEnterBackground:(UIApplication *)application {
2
//Implement TapTalk Omnichannel applicationDidEnterBackground here
3
[[TapTalkLive sharedInstance] applicationDidEnterBackground:application];
4
5
//Other code
6
...
7
...
8
}
Copied!
AppDelegate.m
1
- (void)applicationWillEnterForeground:(UIApplication *)application {
2
3
//Implement TapTalk Omnichannel applicationWillEnterForeground here
4
[[TapTalkLive sharedInstance] applicationWillEnterForeground:application];
5
6
//Other code
7
...
8
...
9
}
Copied!
AppDelegate.m
1
- (void)applicationDidBecomeActive:(UIApplication *)application {
2
3
//Implement TapTalk Omnichannel applicationDidBecomeActive here
4
[[TapTalkLive sharedInstance] applicationDidBecomeActive:application];
5
6
//Other code
7
...
8
...
9
}
Copied!
AppDelegate.m
1
- (void)applicationWillTerminate:(UIApplication *)application {
2
3
//Implement TapTalk Omnichannel applicationWillTerminate here
4
[[TapTalkLive sharedInstance] applicationWillTerminate:application];
5
6
//Other code
7
...
8
...
9
}
Copied!
You have to add below code NSSetUncaughtExceptionHandler(&handleExceptions); in application:didFinishLaunchingWithOptions:method to register uncaught exception handler and add delegate function handleExceptions.
AppDelegate.m
1
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
2
3
//Register Uncaught Exception Handler
4
NSSetUncaughtExceptionHandler(&handleExceptions);
5
}
6
7
//Add delegate function to handle exceptions
8
void handleExceptions(NSException *exception) {
9
//Implement TapTalk Omnichannel handleException method
10
[[TapTalkLive sharedInstance] handleException:exception];
11
}
Copied!
Note: Don't forget to register for exception handler inside application:didFinishLaunchingWithOptions:method and implement handleExceptions method in appDelegate class to make sure TapTalk.io able to handle exceptions.

Step 5: Initialize TapTalk.io Omnichannel iOS in your application class

In order to use TapTalk.io Omnichannel, you must first initialize an instance by passing the APP_KEY_SECRET and API_BASE_URL assigned to your application to the initWithSecretKey: method as a parameter. Generally, initialization is implemented in the appDelegate application:didFinishLaunchingWithOptions: method.
AppDelegate.m
1
// Import TapTalk.io Omnichannel
2
#import <TapTalkLive/TapTalkLive.h>
3
4
@implementation AppDelegate
5
6
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
7
[[TapTalkLive sharedInstance] initWithSecretKey:APP_KEY_SECRET];
8
}
9
10
...
11
12
@end
Copied!
Parameters APP_KEY_SECRET: (String) application key Secret
To allow the Omnichannel iOS SDK to respond to the connection and state changes in your iOS client app, you have to implement all of our application delegate methods in your UIApplicationDelegate methods in appDelegate file. You can follow the instructions in Implement Application Delegate page.

Initialize Google Places API Key (Optional)

To enable location search result preview while sending location message, a Google Places API Key is required. To obtain the API key for your application, you can check the documentation provided by Google. To initialize, insert your obtained key using the initializeGooglePlacesApiKey() method.
1
#import <TapTalkLive/TapTalkLive.h>
2
3
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
4
5
//Initialize Google Places API Key
6
[[TapTalkLive sharedInstance] initializeGooglePlacesAPIKey:GOOGLE_PLACES_API_KEY];
7
}
Copied!
Parameters GOOGLE_PLACES_API_KEY: (String) Google Places API key

Open TapTalk.io Omnichannel View

To open TapTalk Omnichannel's view UI for your application, you can use the presentTapTalkLiveViewWithCurrentNavigationController:animated or pushTapTalkLiveViewWithCurrentNavigationController:animated method from the TapTalkLive class. This will open an activity containing a chat room list for your user, and will open a Create Case Form activity on top if the user is new or do not have any existing case.
1
/**
2
Called to show TapTalk Live view with present animation
3
4
@param navigationController (UINavigationController *) your current navigation controller
5
@param animated (BOOL) make the present animated or not
6
*/
7
[[TapTalkLive sharedInstance] presentTapTalkLiveViewWithCurrentNavigationController:NAVIGATION_CONTROLLER animated:ANIMATED];
8
9
/**
10
Called to show TapTalk Live view with push animation
11
12
@param navigationController (UINavigationController *) your current navigation controller
13
@param animated (BOOL) make the present animated or not
14
*/
15
[[TapTalkLive sharedInstance] pushTapTalkLiveViewWithCurrentNavigationController:NAVIGATION_CONTROLLER animated:ANIMATED];
16
17
/**
18
Obtain main view controller of TapTalk Live
19
*/
20
[[TapTalkLive sharedInstance] getTapTalkLiveViewMainController];
Copied!
Parameters NAVIGATION_CONTROLLER: (UINavigationController) your current active navigation controller ANIMATED: (BOOL) boolean to state animation active or not