Run Demo

This guide provides step-by-step instructions to help you quickly get started with the Chat Demo and experience features such as text, voice, and video messaging. After setup, the application interface appears as shown below:
Login Page
Conversation List Page
Chat Page




Demo app

You can go to Free Demo to download the Chat Demo app to explore the full range of instant messaging features.

Prerequisites

Enable the Service

1. Log in to the Console. If you already have an Application, save your SDKAppID and SDKSecretKey and skip to Environment Preparation.
2. Click Create Application, enter your Application name, select the product to Chat and choose your region, and click Create to add the Application.

3. After creation, you can see your Application’s SDKAppID and SDKSecretKey on the Console Overview page. You will need this information to run the Demo.

Forbidden:
Secure your SDKSecretKey to protect your Application from unauthorized access.

Environment Preparation

Before you begin, ensure the following requirements are met:
Xcode 10 or later
iOS 9.0 or later (physical device or simulator)
CocoaPods 1.7.5 or later. If not installed, refer to CocoaPods Guides - Getting Started.

Instructions

Get the Demo

Note:
This demo uses TRTC's emoji pack with restricted licensing.
Commercial Usage Options
Option A: Keep Our Emoji (Recommended)
Upgrade to Chat Pro Plus or Enterprise Plan and use our emoji pack at no additional cost.
Option B: Use Your Own
Replace default emoji with your own custom designs, or use emoji packs with proper commercial licensing.



Get the Swift Demo
Get the Objective-C Demo
1. Download the Swift Chat UIKit project.
2. In your terminal, navigate to the project directory and locate the GenerateTestUserSig.swift file at: Chat_UIKit/Swift/TUIKitDemo/TUIKitDemo/Private/GenerateTestUserSig.swift
3. Configure the following parameters in GenerateTestUserSig.swift:
public_SDKAPPID: The SDKAppID you obtained above.
public_SECRETKEY: The SDKSecretKey you obtained above.
1. Download the iOS Demo project from GitHub.
2. In your terminal, navigate to the project directory and locate the GenerateTestUserSig.h file at: chat-uikit-ios-main/Demo/TUIKitDemo/Private/GenerateTestUserSig.h
3. Configure the following parameters:
SDKAPPID: The SDKAppID you obtained above.
SECRETKEY: The SDKSecretKey you obtained above.



Warning:
1. In this Demo, authentication uses the SDKSecretKey configured in the client code. The SECRETKEY can be reverse-engineered and compromised. If leaked, attackers can steal your TRTC traffic. This method is for local Demo testing and feature debugging only.
2. In production, generate a UserSig on the server side. When your App needs a UserSig, request a dynamic UserSig from your server for authentication. See Generate UserSig on the Server for details.

Setup the Demo

Run the following command in your terminal to install dependencies:
Swift
Objective-C
# First cd into your downloaded project directory, then cd into the TUIKitDemo directory
cd Swift/TUIKitDemo
pod install
# First cd into your downloaded project directory, then cd into the TUIKitDemo directory
cd iOS/TUIKitDemo
pod install
Note:
If installation fails, run pod repo update to update your local CocoaPods repository.

Build and Run the Demo

Note:
The Demo integrates audio and video call features by default. The audio/video SDK does not currently support simulators. Use a physical device to debug or run the Demo.
For the Swift project, navigate to the Swift/TUIKitDemo folder and open TUIKitDemo.xcworkspace to build and run.
For the Objective-C project, navigate to the chat-uikit-ios-main/Demo folder and open TUIKitDemo.xcworkspace to build and run.
For example, on an iOS device:
1. Connect your iOS device to your computer. On the device, go to Settings > Privacy & Security > Developer Mode and enable Developer Mode.
2. In Xcode, select your test iOS device from the iOS Device dropdown at the top.



3. In the project TARGETS > Signing & Capabilities section, check Automatically manage signing, then configure your Apple developer account and Bundle Identifier for each Target. If you have not signed in to your Apple ID in Xcode, go to Xcode > Preferences > Accounts to add your developer account or Apple ID.



4. Click the run button to build. After a successful build, the TUIKitDemo is automatically installed on your device.
5. Open the App and enter any userid to create and log in to a user account.


Experience Basic Features

Create a User Account

After running the Demo, you can test the basic features of Chat.
First, create a user account. You can register directly in the Demo client or create an account in the Console. Choose one of the following methods:
Client Registration
Console Registration
Enter an userID in the Demo and log in to the Demo app.
Follow these steps to create a user account:
1. Click to enter the Application you created above. In the left sidebar, locate the Chat product entry and click to enter.
2. On the Chat product subpage, click Users to access the user management page.
3. Click Create account. For regular members, select the General type. While Nickname is optional, we recommend setting it. If the interface does not display userID clearly, use Nickname to distinguish users.

As shown below:



Tips:
Sending messages requires at least two users. Create at least two accounts at this stage and record their userIDs for later steps.

Add Contacts

To add contacts:
1. On the Contacts page, click the + button in the upper right corner and select Add to Contacts from the submenu.
2. Enter a valid userID to search for the user. If you created accounts in the Console, obtain valid userIDs from the Console’s Account Management page. Path: Applications > Your App > Chat > Users > Account Management.
3. Add a user as a contact.
Click Add to Contacts
Search for User
Send Add Contact Request









After adding a user successfully, the contact list displays the user you just added:


Send Messages

Select a user, click Message, and enter the message interface:

You can now send text, voice, image, and video call messages to this user:


FAQ

1. How to fix "pod does not exist" or "pod version less than 1.7.5" error during pod install?

Run the following commands to install the latest pod.
# 1. Install pod
sudo gem install cocoapods -n /usr/local/bin
# If you have multiple Xcode versions installed, use the following command to select the Xcode version (generally choose the latest).
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

# 2. Update the local pod repository
pod setup

2. TUICore version incompatibility

When using CocoaPods to get the Demo, if the TUICore version locked in the Podfile.lock file is incompatible with the plugin dependency, you may encounter the following error: CocoaPods could not find compatible versions for pod "TUICore"
Follow these steps to solve this:
1. In your Demo project root directory, run the following command to delete the Podfile.lock file:
rm Podfile.lock
2. Run the following command to update the local code repository:
pod repo update
3. Run the following command to reinstall:
pod update
After completing these steps, a new Podfile.lock file will be generated and dependencies installed successfully.

3. Untrusted Developer

If you are debugging on a physical device and see an "Untrusted Developer" prompt after a successful build, tap Cancel to close the prompt. Then, on your iOS device, go to Settings > General > VPN & Device Management, select the developer app, and trust the developer. After that, open the Demo App to continue.

Contact Us

If you have any questions or suggestions during integration or usage, Contact Us for support and feedback.