tencent cloud

Feedback

Last updated: 2022-05-29 11:45:29

    This document describes how to quickly run the IM demo for iOS.

    Directions

    Step 1. Create an app

    1. Log in to the IM console.
      Note:

      If you already have an app, record its SDKAppID and obtain key information.
      A Tencent Cloud account can create a maximum of 300 IM apps. If you want to create a new app, disable and delete an unwanted app first. Once an app (along with its SDKAppID) is deleted, the provided service and all its data are lost. Please proceed with caution.

    2. Click Create Application, enter your app name, and click Confirm.
    3. 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.

    Step 2. Obtain key information

    1. Click the target app card to go to the basic configuration page of the app.
    2. In the Basic Information area, click Display key, and then copy and save the key information.
      Note:

      Please store the key information properly to prevent disclosure.

    Step 3. Download and configure the demo source code

    1. Download the IM demo project. For more information, see SDK and Demo Source Code.
      Note:

      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 IM demo may infringe on the design copyright.

    2. Open the project in the terminal directory and find the GenerateTestUserSig file in the following paths:
      iOS: iOS/Demo/TUIKitDemo/Private/GenerateTestUserSig.h
      macOS: Mac/Demo/TUIKitDemo/Debug/GenerateTestUserSig.h
    3. Set relevant parameters in the GenerateTestUserSig file:
    • SDKAPPID: Set it to the SDKAppID obtained in Step 1.
    • SECRETKEY: Enter the key obtained in Step 2.
    Note:

    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.
    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 Generating UserSig on the Server.

    Step 4. Compile and run the demo

    See the file README.md in the corresponding directory of the demo project cloned in Step 3.

    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 sources.
    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 the local pod library.
    pod setup
    
    1. Run the following commands on the terminal to install dependent libraries:

      // iOS
      cd iOS/TUIKitDemo
      pod install
      // macOS
      cd Mac/TUIKitDemo
      pod install
      

      If installation fails, run the following command to update the local CocoaPods repository list:

      pod repo update
      
    2. 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.

    Advanced Features

    References

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support