This document describes how to quickly integrate the TRTC macOS SDK into your project.
You can use CocoaPods to automatically load the SDK or download and import it manually into your project.
Enter the following command in a terminal window (you need to install Ruby on your Mac first):
sudo gem install cocoapods
Go to the directory of your project and enter the following command to create a Podfile in the directory.
pod init
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 a terminal window to install the SDK.
pod install
Or, run this command to update the local repository:
pod update
An XCWORKSPACE project file integrated with LiteAVSDK will be generated. Double-click to open the file.
AudioUnit.framework
, libc++.tbd
, and Accelerate.framework
.To use the audio/video features of the SDK, you need to grant it mic and camera permissions. Add the two items below to Info.plist
of your application. Their content is what users see in the mic and camera access pop-up windows.
If App Sandbox or Hardened Runtime is enabled for your application, select Network
, Camera
, and Audio Input
.
You can import the TRTC SDK in two ways.
There are two ways to use the SDK in Objective-C or Swift:
Import the module: Import the SDK module in the files that will use the SDK APIs.
@import TXLiteAVSDK_TRTC_Mac;
Import the header file: Import the header file in the files that will use the SDK APIs.
#import TXLiteAVSDK_TRTC_Mac/TRTCCloud.h
Import the header file: If you want to use C++ APIs to develop your macOS application, import the header file in the TXLiteAVSDK_TRTC_Mac.framework/Headers/cpp_interface
directory.
#include TXLiteAVSDK_TRTC_Mac/cpp_interface/ITRTCCloud.h
Use the namespace: The cross-platform C++ APIs and types are all defined in the TRTC namespace, which you can use directly. This method can simplify your code and is recommended.
using namespace trtc;
Note:For more information on how to use C++ APIs, please see Overview.
Was this page helpful?