tencent cloud

Feedback

iOS and macOS

Last updated: 2024-05-13 10:43:55
    This document describes how to quickly run TRTC-API-Example (iOS and macOS).

    Environment Requirements

    Xcode 11.0 or later
    A valid developer signature for your project
    Qt Creator 4.13.3 (macOS) or later

    Prerequisites

    Directions

    Step 1. Create an application

    1. Log in to the TRTC console overview page, click Create Application.
    2. In the popup page, select RTC Engine, enter the application name, and then click Create.
    
    
    
    3. After your application created, you can get your SDKAppID and SDKSecretKey on Basic informaction. SDKAppID and SDKSecretKey is needed for running demo.
    
    
    

    Step 2. Download the SDK and demo source code

    1. You can download the sample code for IOS&Mac platform on github.
    2. The steps to import SDK can refer to IOS SDK import .

    Step 3. Configure demo project files

    1.Find and open GenerateTestUserSig.h or GenerateTestUserSig.swift.
    Platform
    Path
    IOS&MAC-Swift
    TRTC-API-Example-Swift/Debug/GenerateTestUserSig.swift
    IOS&MAC-OC
    TRTC-API-Example-OC/Debug/GenerateTestUserSig.h
    2.Please Modify SDKAppID and SDKSECRETKEY
    SDKAPPID: `0` by default. Set it to the actual `SDKAppID`.
    SDKSECRETKEY: left empty by default. Set it to the actual key.
    Note
    The method for generating UserSig described in this document involves configuring SDKSECRETKEY in the client code. In this method, SDKSECRETKEY may be easily decompiled and reversed, and if your key is disclosed, attackers can steal your Tencent Cloud traffic. Therefore, this method is only suitable for the local execution and debugging of TRTC-API-Example.
    The best practice is to integrate the calculation code of UserSig into your server and provide an application-oriented API. When UserSig is needed, your application can send a request to your server for a dynamic UserSig. For more information, see How do I calculate UserSig during production?.

    Step 4. Compile and run the demo

    Open the TRTC-API-Example-OC.xcworkspace project in the source code directory with Xcode (11.0 or later) and compile and run the TRTC-API-Example project.

    FAQs

    1. The demo is running on two mobile phones, but why can't they display the images of each other?

    Make sure that the two mobile phones use different UserID. With TRTC, you cannot use the same UserID on two devices simultaneously unless the SDKAppID is different.

    2. What are the restrictions of the firewall?

    The SDK uses the UDP protocol for audio/video transmission and therefore cannot be used in office networks that block UDP. If you encounter such a problem, refer to Firewall Restrictions to troubleshoot the issue.
    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