This document describes how to quickly integrate the Tencent Cloud TRTC SDK for macOS into your project in the following steps.
You can choose to use CocoaPods for automatic loading or manually download the SDK first and then import it into your current project.
Enter the following command in the terminal window (you need to install the Ruby environment on your macOS in advance):
sudo gem install cocoapods
Go to the path to the project, enter the following command, and a Podfile will appear in the project path.
There are two ways to edit the Podfile:
platform :osx, '10.10' target 'Your Target' do pod 'TXLiteAVSDK_TRTC_Mac', :podspec => 'https://liteav.sdk.qcloud.com/pod/liteavsdkspec/TXLiteAVSDK_TRTC_Mac.podspec' end
platform :osx, '10.10' source 'https://github.com/CocoaPods/Specs.git' target 'Your Target' do pod 'TXLiteAVSDK_TRTC_Mac' end
Enter the following command in the terminal window to install the TRTC SDK:
Or, run the following command to update the local library:
After the pod command is executed, a project file with the .xcworkspace extension integrated with the SDK will be generated. Double-click it to open it.
Download the macOS version of the TRTC-SDK.
Open your Xcode project and import the framework downloaded in the first step into it.
Select the target you want to run and check "Build Phases".
Click Link Binary with Libraries to expand it and then click the "+" icon at the bottom to add the dependent library.
Add the downloaded SDK Framework and its required dependent library in sequence:
Successful addition is as shown below:
To use the audio/video features of the SDK, you need to grant the mic and camera access. Add the following two items to the application's
Info.plist which correspond to the prompt messages of the mic and camera respectively when the authorization dialog box pops up.
If App Sandbox or Hardened Runtime is enabled, you need to select
Audio Input options.
There are two ways to use the SDK in your project code:
Method 1: add an import module to the project's files that need to use an SDK API.
Method 2: import specific header files into the project's files that need to use an SDK API.