please select
  • UIKit
  • SDK
  • Server APIs
Chat/
UIKit/
iOS and macOS/
UIKit
  • Overview
  • Run Demo
  • Getting Started
  • Installation
    • TUIKit
    • TUIChat Only
  • Build Basic Interfaces
    • Chat
    • Conversation List
    • Contact List
    • Add Contact
    • Create Group Chat
    • Video and Audio Call
  • Features
    • Reactions
    • Quote
    • Read Receipt
    • User Online Status
    • Translation
    • Voice to Text
    • Search Messages
  • Customization
    • Customize Messages
    • Customize Emojis and Stickers
  • Localization
  • Changelog
  • Guideline for Beginners
  • Console Guide
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
  • Product Introduction
    • Message Management
      • One-to-One Message
      • Message Storage
      • Offline Push
      • Group Message
      • Message Formats
    • Account System
      • Login Authentication
      • Online Status Management
    • Group Related
      • Group System
      • Group Management
    • User Profile and Relationship Chain
      • Profile Management
      • Relationship Chain Management
  • Purchase Guide
    • Billing Overview
    • Pricing
  • Error Codes

Run Demo

This document mainly describes how to quickly run the Chat Demo.

Directions

1. Create an App

1. Log in to the Chat console. If you already have an app, record its SDKAppID and SDKSecretKey.
Note:
1. A Chat account can create a maximum of 300 Chat apps. If you want to create a new app, you can disable and delete an unwanted app first.
2. Once an app (along with its SDKAppID) is deleted, the service it provides and all its data are lost. Please operate with caution.
2. Click Create Application, enter your Application name, product, Region, and click Create.


2. Obtain SDKAppID and SDKSecretKey

After creation, you can view the newly created app's Status, SDKAppID, Expiration time, etc., on the Applications page:



Record the SDKAppID and SDKSecretKey from the Application Information.
Danger:
Keep the SDKSecretKey properly to prevent disclosure.

3. Download and Configure the Demo

1. Download the iOS demo project from Github.
2. Open the project in the terminal directory and find the GenerateTestUserSig.h file. The path is:
iOS:iOS/Demo/TUIKitDemo/Private/GenerateTestUserSig.h
macOS:Mac/Demo/TUIKitDemo/Debug/GenerateTestUserSig.h
3. Set the relevant parameters:
SDKAPPID: set it to the SDKAppID obtained above.
SECRETKEY: set it to the SDKSecretKey obtained above.

Warning:
1. In this document, the method to obtain UserSig is to configure a SECRETKEY in the client code. In this method, the SECRETKEY is vulnerable to decompilation and reverse engineering. Once your SECRETKEY is disclosed, attackers can steal your Tencent Cloud traffic. Therefore, this method is only suitable for locally running a demo project and feature debugging.
2. The correct UserSig distribution method is to integrate the calculation code of UserSig into your server and provide an app-oriented API. When UserSig is needed, your app can send a request to the business server to obtain a dynamic UserSig. For more information, see How to Generate UserSig on the Server.
3. To respect the copyright of emoji design, the downloaded demo project does not contain sliced images of major emoji elements. You can use your local emoji packs to configure code. Unauthorized use of the emoji pack in the Chat demo may infringe on the design copyright.

4. Compile and Run the Demo

See the file README.md in the corresponding directory of the demo project cloned above.
1. Run the following command on the terminal to check the pod version:
pod --version
If the system indicates that no pod exists or that the pod version is earlier than 1.7.5, run the following commands to install the latest pod.
//Change Gem Source
gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com/
//Install pod
sudo gem install cocoapods -n /usr/local/bin
// If multiple versions of Xcode are installed, run the following command to choose an Xcode version (usually the latest one):
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
//Update Pod Local Repository
pod setup
2. Run the following commands on the terminal to install dependent libraries:
//iOS
cd iOS/TUIKitDemo
pod install
//Mac
cd Mac/TUIKitDemo
pod install
If installation fails, run the following command to update the local CocoaPods repository list:
pod repo update
3. Compile and run the demo:
iOS: Go to the iOS/TUIKitDemo folder, and open TUIKitDemo.xcworkspace to compile and run the demo.
macOS: Go to the Mac/TUIKitDemo folder, and open TUIKitDemo.xcworkspace to compile and run the demo.
Note:
The demo is integrated with the audio/video call feature by default. However, the TRTC SDK on which the audio/video call feature relies currently does not support simulators. Please use real devices for demo running or debugging.