English | 简体中文
This document introduces how to quickly run through the IM demo.
In respect for the copyright of the emoji design, the Chat Demo/TUIKit project does not include the cutouts of large emoji elements. Please replace them with your own designed or copyrighted emoji packs before the official launch for commercial use. The default small yellow face emoji pack is copyrighted by Tencent Cloud and can be authorized for a fee. If you wish to obtain authorization, please submit a ticket to contact us.
- Log in to the IM console.
If you already have an app, record its SDKAppID and configure the app.
- Click Create Application, enter your app name, and click Confirm.
- After creation, you can see the status, service version, SDKAppID, creation time, tag, and expiry time of the new app on the overview page of the console. Record the SDKAppID.
- Click the target app card to go to the basic configuration page of the app.
- In the Basic Information area, click Display key, and then copy and save the key information.
Please store the key information properly to prevent leakage.
- Clone the IM demo project from GitHub.
- Open the project in the terminal directory and find the
GenerateTestUserSig
file.
Platform | Relative Path to File |
---|---|
Android | Android/Demo/app/src/main/java/com/tencent/qcloud/tim/demo/signature/GenerateTestUserSig.java |
iOS | iOS/Demo/TUIKitDemo/Private/GenerateTestUserSig.h |
macOS | Mac/Demo/TUIKitDemo/Debug/GenerateTestUserSig.h |
Windows | Windows/Demo/IMApp/GenerateTestUserSig.h |
Web (general) | Web/Demo/public/debug/GenerateTestUserSig.js |
Mini Program | MiniProgram/Demo/static/utils/GenerateTestUserSig.js |
- Set relevant parameters in the
GenerateTestUserSig
file:
In this document, an Android project is opened by using Android Studio as an example.
! 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 leaked, attackers can steal your Tencent Cloud traffic. Therefore, this method is only suitable for locally running a demo project and feature debugging. The correct
UserSig
distribution method is to integrate the calculation code ofUserSig
into your server and provide an application-oriented API. WhenUserSig
is needed, your app can send a request to the business server for a dynamicUserSig
. For more information, please see How do I calculate UserSig on the server?.
- 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 sources.
gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com/
// Install pods.
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 the local pod library.
pod setup
- Run the following commands on the terminal to load the IMSDK library.
cd iOS/Demo
pod install
- If installation fails, run the following command to update the local CocoaPods repository list:
pod repo update
cd iOS/Demo
pod install (if there is an error, execute pod update)
- Go to the iOS/Demo folder and open
TUIKitDemo.xcworkspace
to compile and run the demo.
If you do not need the audio/video call feature, remote it as follows:
- Go to the
iOS/Demo
folder, comment out the TUICallKit pod in the Podfile, and run thepod install
command.
# pod 'TUICallKit' (Stop integrating the library)
- Go to the Building Settings page of the TUIKitDemo and set
ENABLECALL
to0
to disable audio/video call related logic.
After the preceding steps are completed, the audio and video call entries in the demo are hidden.
The conversation UIs before and after TUICallKit masking are as follows:
The contact profile UIs before and after TUICallKit masking are as follows:
The above only shows how to remove the audio/video call feature from the demo. Developers can customize the demo according to their business requirements.
Go to the iOS/Demo
folder, comment out the TUISearch pod in the Podfile, and run the pod install
command.
# pod 'TUISearch' (Stop integrating the library)
After the preceding steps are completed, the message search box in the demo is hidden.
The message UIs before and after TUISearch masking are as follows:
The above only shows how to remove the search feature from the demo. Developers can customize the demo according to their business requirements.