This document describes how to quickly integrate the Tencent Cloud IM SDK (iOS) to your projects. To configure and integrate the SDK, follow these steps.
You can either automatically integrate the IM SDK using CocoaPods, or manually download the SDK and import it to 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 where the project is located and run the following command. Then, a Podfile will appear under the project path.
pod init
If you are using the SDK basic edition, edit the Podfile as follows:
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'App' do
pod 'TXIMSDK_iOS'
end
If you are using the SDK enhanced edition, edit the Podfile as follows:
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'App' do
pod 'TXIMSDK_Plus_iOS'
end
If you are using the SDK bitcode enhanced edition, edit the Podfile as follows:
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'App' do
pod 'TXIMSDK_Plus_iOS_Bitcode'
end
If you are using the SDK XCFramework enhanced edition, edit the Podfile as follows:
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'App' do
pod 'TXIMSDK_Plus_iOS_XCFramework'
end
If you are using the SDK XCFramework enhanced edition (bitcode supported), edit the Podfile as follows:
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'App' do
pod 'TXIMSDK_Plus_iOS_Bitcode_XCFramework'
end
Run the following command in the terminal window to update the local library file and install the TXIMSDK:
pod install
Or, run the following command to update the local repository:
pod update
After the pod command is executed, an .xcworkspace project file integrated with the SDK will be generated. Double-click this file to open it.
Note:If the pod search fails, you are advised to update the local repo cache of the pod by running the following commands:
>pod setup pod repo update rm ~/Library/Caches/CocoaPods/search_index.json
Download the latest SDK version from GitHub:
ImSDK.framework
and ImSDK_Plus.framework
are the core dynamic library files of the IM SDK.Package Name | Description |
---|---|
ImSDK.framework | IM SDK basic edition |
ImSDK_Plus.framework | IM SDK enhanced edition |
Package Name | Description | Feature |
---|---|---|
TXLiteAVSDK_UGC.framework | Extension package for recording and editing short videos | This package provides short video recording and editing features. For more information, see UGSV SDK Documentation. |
Create a project.
Enter a project name, for example, IMDemo.
Add the dependency library: select Target for IMDemo. On the General panel, add the dependency library under Embedded Binaries and Linked Frameworks and Libraries. If you use the SDK basic edition, select ImSDK.framework. If you use the SDK enhanced edition, select ImSDK_Plus.framework.
Set link parameters: add -ObjC
in **Build Setting -> Other Linker Flags.
Note:For manual integration, you need to change
ImSDK.framework
toEmbed&Sing
in Target -> General -> Frameworks -> Libraries and Embedded Content.
There are two ways to use the SDK in your project code.
Choose Xcode -> Build Setting -> Header Search Paths, and set the SDK header file path. In files that require the SDK API, reference the corresponding header file.
#import "ImSDK.h"
#import "ImSDK_Plus.h"
In files that require the SDK API, reference the corresponding header file.
#import <ImSDK/ImSDK.h>
#import <ImSDK_Plus/ImSDK_Plus.h>
Was this page helpful?