This document describes how to quickly integrate the Tencent Cloud TRTC SDK for iOS into your project in the following steps.
You can choose to use CocoaPods for automatic loading or 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 of the project, enter the following command, and a Podfile will appear in the project path.
Edit the Podfile and select the appropriate SDK version as needed:
Lite: it has the smallest installation package but only supports TRTC and CDN playback (TXLivePlayer) features.
platform :ios, '8.0' target 'App' do pod 'TXLiteAVSDK_TRTC', :podspec => 'https://liteav.sdk.qcloud.com/pod/liteavsdkspec/TXLiteAVSDK_TRTC.podspec' end
Pro: in addition to TRTC, it also includes RTMP push (TXLivePusher), CDN playback (TXLivePlayer), VOD playback (TXVodPlayer), short video (UGSV), and other features.
platform :ios, '8.0' target 'App' do pod 'TXLiteAVSDK_Professional', :podspec => 'https://liteav.sdk.qcloud.com/pod/liteavsdkspec/TXLiteAVSDK_Professional.podspec' end
You can also use an official CocoaPods source, but the download may be slow:
platform :ios, '8.0' source 'https://github.com/CocoaPods/Specs.git' target 'App' do pod 'TXLiteAVSDK_TRTC' end
Enter the following command in the terminal window to update the local library file and 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.
Add the required dependent library Accelerate.framework.
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.
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.
Yes. If you want the SDK to run relevant features in the background, you can select the current project, set Background Modes under Capabilities to ON, and check Audio, AirPlay and Picture in Picture as shown below: