With iOS Mobile app in Objective-C
Overview
The CuVo Chatbot Agent supports iOS versions ranging from iOS 11.0 to the most current version with Swift5 as the programming language used.
This integration document explains how to easily integrate the CuVo chatbot into your app, enhancing user interactions and providing valuable customer support.
Integrating CuVo Chabot Agent into Your iOS Application
After creating an account and configuring the chat agent, you will see the Integration steps section. Generate an API key, select Mobile for Platform and iOS Objective C for Technology. Now you have the code snippet, chat library and integration instructions for integration with your swift app for iOS mobile.
Click the Download SDK button to download and save the CuVo agent library file. The file would be most likely be named CuvoChatAgent.framework.zip. Unzip/Decompress the downloaded zip file to get the integration framework folder.
To integrate the CuVo Chatbot Agent into your iOS application, follow the steps below.
1. Drag and drop the CuvoChatAgent.framework file to the project root directory on your xcode project.
2. Go to your projects target, in the General tab – Frameworks, Libraries and Embedded content section.
3. Ensure that the framework you imported is listed there and the Embed and sign option is selected.
4. Import the CuvoChatAgent into your app delegate or scene delegate file, depending on where your application’s window management and lifecycle are handled.
5. Add the following code to your project’s app delegate or scene delegate.
#import <CuvoChatAgent/CuvoChatAgent-Swift.h>
6. Copy the code snippet you see in your Integration Steps section and paste it in the didfinishlaunching delegate of your app. Your code snippet will look like the code shown below. The success key in completion handler lets you know the integration with chat agent is successful or not.
CuvoChatAgentManager * cuvoChatManager = [[CuvoChatAgentManager alloc] init];
[cuvoChatManager updateAgnetDetailsWithKeyWindow:self.window
isCustomButton: YES
orgId: @"<YOUR_ORG_ID_ON_OUR_PORTAL>"
prodId: @"<YOUR_ACCOUNT_ID_ON_OUR_PORTAL>"
productVersion: @"<YOUR_ACCOUNT_VERSION_ON_OUR_PORTAL>"
apiKey: @"<YOUR_API_KEY_TO_ACCESS_OUR_APP>"
completion: ^(BOOL success) {
if (success) {
// API call succeeded. Add your handler code.
NSLog(@"API call succeeded");
} else {
// API call failed. Add your handler code.
NSLog(@"API call failed");
}
}
];

In the above example, we have added our prodID, product version, orgID and api key. The code snippet you copy from the portal should have your appropriate product ID, product version, organization ID and API key already filled in.
Note: The above example image is just representative and the actual code snippet can differ from the image.
Note: f you want to use your own button in your application and don’t want to display the frameworks button, send the isCustomButton as false.
7. Build the project and run the application.
The chat icon is displayed. You are now enabled to converse with the bot to address any issues.

Hiding the Chat Icon
You can hide a chat icon in a particular view controller by following the steps below.
1. Import the CuvoChatAgent in the class.
2. Add the below code in the willappear delegate.

Showing the Chat Icon
To show the chat button that is hidden, use the following code

Opening Chat Screen with Your Custom Button
You can open the chat screen using your own custom button or from the hamburger menu by following the steps below.
1. Import the CuvoChatAgent in the class.
2. Add the below code.

or
[cuvomanager openChatView(vc)];
If the parameter vc is passed then the chat view is served using vc, otherwise it is served using the top level controller.
Note: If you are having issues running the app in the simulator after integrating the framework, you can try resolving it by adding arm64 in the Excluded architecture for any iOS simulator key. For more information, refer to the Adding Arm64 section.
Adding Arm64
The steps to add arm64 are simple as follows.
1. Open your project.
2. Navigate to Build Settings within your project settings.
3. Expand the Excluded Architectures section.
4. Add a new row.
5. Set the key to the iOS simulator.
6. Add the value arm64.