Implement 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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Implement TapTalk Omnichannel didFinishLaunchingWithOptions here
[[TapTalkLive sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
//Other code
...
...
return YES;
}
// AppDelegate.m
- (void)applicationWillResignActive:(UIApplication *)application {
//Implement TapTalk Omnichannel applicationWillResignActive here
[[TapTalkLive sharedInstance] applicationWillResignActive:application];
//Other code
...
...
}
// AppDelegate.m
- (void)applicationDidEnterBackground:(UIApplication *)application {
//Implement TapTalk Omnichannel applicationDidEnterBackground here
[[TapTalkLive sharedInstance] applicationDidEnterBackground:application];
//Other code
...
...
}
// AppDelegate.m
- (void)applicationWillEnterForeground:(UIApplication *)application {
//Implement TapTalk Omnichannel applicationWillEnterForeground here
[[TapTalkLive sharedInstance] applicationWillEnterForeground:application];
//Other code
...
...
}
// AppDelegate.m
- (void)applicationDidBecomeActive:(UIApplication *)application {
//Implement TapTalk Omnichannel applicationDidBecomeActive here
[[TapTalkLive sharedInstance] applicationDidBecomeActive:application];
//Other code
...
...
}
// AppDelegate.m
- (void)applicationWillTerminate:(UIApplication *)application {
//Implement TapTalk Omnichannel applicationWillTerminate here
[[TapTalkLive sharedInstance] applicationWillTerminate:application];
//Other code
...
...
}

You have to add below code NSSetUncaughtExceptionHandler(&handleExceptions); in application:didFinishLaunchingWithOptions:method to register uncaught exception handler and add delegate function handleExceptions.

//AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Register Uncaught Exception Handler
NSSetUncaughtExceptionHandler(&handleExceptions);
}
//Add delegate function to handle exceptions
void handleExceptions(NSException *exception) {
//Implement TapTalk Omnichannel handleException method
[[TapTalkLive sharedInstance] handleException:exception];
}

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.