sudo gem install cocoapods
# Uncomment the next line to define a global platform for your project# ...source 'https://github.com/CocoaPods/Specs.git'platform :ios, '13.0'# Prevent `*.xcassets` in TUIKit from conflicting with your projectinstall! 'cocoapods', :disable_input_output_paths => true# Replace `your_project_name` with your actual project nametarget 'your_project_name' do# Comment the next line if you don't want to use dynamic frameworks# TUIKit components are dependent on static libraries. Therefore, you need to mask the configuration.# use_frameworks!# Enable modular headers as needed. Only after you enable modular headers, the Pod module can be imported using @import.# use_modular_headers!# Integrate the chat featurepod 'TUIChat/UI_Minimalist'# Integrate the conversation list featurepod 'TUIConversation/UI_Minimalist'# Integrate the relationship chain featurepod 'TUIContact/UI_Minimalist'# Integrate the group featurepod 'TUIGroup/UI_Minimalist'# Integrate the search feature (To use this feature, you need to purchase the Premium edition)pod 'TUISearch/UI_Minimalist'# Integrate the offline push featurepod 'TUIOfflinePush'# Integrate the audio/video call featurepod 'TUICallKit'end#Pods configpost_install do |installer|installer.pods_project.targets.each do |target|target.build_configurations.each do |config|#Fix Xcode14 Bundle target errorconfig.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"config.build_settings['ENABLE_BITCODE'] = "NO"config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "13.0"#Fix Xcode15 other links flag -ld64xcode_version = `xcrun xcodebuild -version | grep Xcode | cut -d' ' -f2`.to_fif xcode_version >= 15xcconfig_path = config.base_configuration_reference.real_pathxcconfig = File.read(xcconfig_path)if xcconfig.include?("OTHER_LDFLAGS") == falsexcconfig = xcconfig + "\\n" + 'OTHER_LDFLAGS = $(inherited) "-ld64"'elseif xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == falsexcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")endif xcconfig.include?("-ld64") == falsexcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld64"')endendFile.open(xcconfig_path, "w") { |file| file << xcconfig }endendendend
# Uncomment the next line to define a global platform for your projectsource 'https://github.com/CocoaPods/Specs.git'platform :ios, '13.0'# Prevent `*.xcassets` in TUIKit from conflicting with your projectinstall! 'cocoapods', :disable_input_output_paths => true# Replace `your_project_name` with your actual project nametarget 'your_project_name' do# Comment the next line if you don't want to use dynamic frameworks# TUIKit components are dependent on static libraries. Therefore, you need to mask the configuration.# use_frameworks!# Enable modular headers as needed. Only after you enable modular headers, the Pod module can be imported using @import.# use_modular_headers!# Integrate the chat featurepod 'TUIChat/UI_Classic'# Integrate the conversation list featurepod 'TUIConversation/UI_Classic'# Integrate the relationship chain featurepod 'TUIContact/UI_Classic'# Integrate the group featurepod 'TUIGroup/UI_Classic'# Integrate the search feature (To use this feature, you need to purchase the Premium edition)pod 'TUISearch/UI_Classic'# Integrate the offline push featurepod 'TUIOfflinePush'# Integrate the audio/video call featurepod 'TUICallKit'end#Pods configpost_install do |installer|installer.pods_project.targets.each do |target|target.build_configurations.each do |config|#Fix Xcode14 Bundle target errorconfig.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"config.build_settings['ENABLE_BITCODE'] = "NO"config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "13.0"#Fix Xcode15 other links flag -ld64xcode_version = `xcrun xcodebuild -version | grep Xcode | cut -d' ' -f2`.to_fif xcode_version >= 15xcconfig_path = config.base_configuration_reference.real_pathxcconfig = File.read(xcconfig_path)if xcconfig.include?("OTHER_LDFLAGS") == falsexcconfig = xcconfig + "\\n" + 'OTHER_LDFLAGS = $(inherited) "-ld64"'elseif xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == falsexcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")endif xcconfig.include?("-ld64") == falsexcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld64"')endendFile.open(xcconfig_path, "w") { |file| file << xcconfig }endendendend
pod 'TUIChat'
without specifying the classic or minimalist version, the two versions of UI components will be integrated by default.
2. The classic and minimalist versions of UI components cannot be used together. If you integrate multiple components, all the integrated components must be of the same version: classic or minimalist.
For example, the classic version TUIChat must be used together with the classic version TUIConversation, TUIContact, and TUIGroup, and the minimalist version TUIChat must be used together with the minimalist version TUIConversation, TUIContact, and TUIGroup.
3. If you use Swift, enable use_modular_headers!
and change the reference of the header file to the reference format of @import module name.pod install
pod repo update
pod update
# Uncomment the next line to define a global platform for your projectsource 'https://github.com/CocoaPods/Specs.git'platform :ios, '13.0'install! 'cocoapods', :disable_input_output_paths => true# Replace `your_project_name` with your actual project nametarget 'your_project_name' do# Uncomment the next line if you're using Swift or would like to use dynamic frameworksuse_frameworks!use_modular_headers!# Note: To perform upgrade when using a local integration solution, you need to access# https://github.com/TencentCloud/TIMSDK/tree/master/iOS/TUIKit# to obtain the latest component code, and place it in the local specified directory, such as /TIMSDK/ios/TUIKit/TUICore.# Note: When custom modifications conflict with remote changes, you need to manually merge them to resolve conflicts.# Integrate the basic library (required)pod 'TUICore', :path => "../TUIKit/TUICore"pod 'TIMCommon', :path => "../TUIKit/TIMCommon"# Integrate TUIKit components (optional)# Integrate the chat featurepod 'TUIChat', :path => "../TUIKit/TUIChat"# Integrate the conversation list featurepod 'TUIConversation', :path => "../TUIKit/TUIConversation"# Integrate the relationship chain featurepod 'TUIContact', :path => "../TUIKit/TUIContact"# Integrate the group featurepod 'TUIGroup', :path => "../TUIKit/TUIGroup"# Integrate the search feature (To use this feature, you need to purchase the Ultimate edition)pod 'TUISearch', :path => "../TUIKit/TUISearch"# Integrate the offline push featurepod 'TUIOfflinePush', :path => "../TUIKit/TUIOfflinePush"# Integrate the audio/video call featurepod 'TUICallKit'# Integrate the video conference featurepod 'TUIRoomKit'# Integrate the TUIKitPlugin plugin (optional)# Note: The TUIKitPlugin plugin version must be the same as the TUICore version.# Ensure that the plugin version matches spec.version in "../TUIKit/TUICore/TUICore.spec".# Integrate the voting plugin, supported from version 7.1pod 'TUIPollPlugin', '7.6.5011'# Integrate the group chain plugin, supported from version 7.1pod 'TUIGroupNotePlugin', '7.6.5011'# Integrate translation plugin, supported from version 7.2 (Value-added feature activation is required. Please contact Tencent Cloud sales)pod 'TUITranslationPlugin', '7.6.5011'# Integrate the session grouping plugin, supported from version 7.3pod 'TUIConversationGroupPlugin', '7.6.5011'# Integrate the session tagging plugin, supported from version 7.3pod 'TUIConversationMarkPlugin', '7.6.5011'# Other Podspod 'MJRefresh'pod 'Masonry'end#Pods configpost_install do |installer|installer.pods_project.targets.each do |target|target.build_configurations.each do |config|#Fix Xcode14 Bundle target errorconfig.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"config.build_settings['ENABLE_BITCODE'] = "NO"config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "13.0"#Fix Xcode15 other links flag -ld64xcode_version = `xcrun xcodebuild -version | grep Xcode | cut -d' ' -f2`.to_fif xcode_version >= 15xcconfig_path = config.base_configuration_reference.real_pathxcconfig = File.read(xcconfig_path)if xcconfig.include?("OTHER_LDFLAGS") == falsexcconfig = xcconfig + "\\n" + 'OTHER_LDFLAGS = $(inherited) "-ld64"'elseif xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == falsexcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")endif xcconfig.include?("-ld64") == falsexcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld64"')endendFile.open(xcconfig_path, "w") { |file| file << xcconfig }endendendend
Login
on your app.
You need to create an app and obtain the SDKAppID in the Chat console. userSig
needs to be calculated according to rules. For operation details, see Get Started.#import "TUILogin.h"- (void)loginSDK:(NSString *)userID userSig:(NSString *)sig succ:(TSucc)succ fail:(TFail)fail {[TUILogin login:SDKAppID userID:userID userSig:sig succ:^{NSLog(@"Login successful");} fail:^(int code, NSString *msg) {NSLog(@"Login failed");}];}
TUIConversationListController
object. The conversation list reads recent contacts from the database. When a user clicks a contact, TUIConversationListController
calls back the didSelectConversation
event to the upper layer.#import "TUIConversationListController_Minimalist.h"// ConversationController is your own ViewController@implementation ConversationController- (void)viewDidLoad {[super viewDidLoad];// TUIConversationListController_MinimalistTUIConversationListController_Minimalist *vc = [[TUIConversationListController_Minimalist alloc] init];vc.delegate = self;// Add TUIConversationListController_Minimalist to your own ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}- (void)conversationListController:(TUIConversationListController_Minimalist *)conversationControllerdidSelectConversation:(TUIConversationCell *)conversation{// Conversation list click event, typically, opening the chat UI}@end
#import "TUIConversationListController.h"// ConversationController is your own ViewController@implementation ConversationController- (void)viewDidLoad {[super viewDidLoad];// TUIConversationListControllerTUIConversationListController *vc = [[TUIConversationListController alloc] init];vc.delegate = self;// Add TUIConversationListController to your own ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}- (void)conversationListController:(TUIConversationListController *)conversationControllerdidSelectConversation:(TUIConversationCell *)conversation{// Conversation list click event, typically, opening the chat UI}@end
#import "TUIC2CChatViewController_Minimalist.h"// ChatViewController is your own ViewController@implementation ChatViewController- (void)viewDidLoad {// Create conversation informationTUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];data.userID = @"userID";// Create TUIC2CChatViewController_MinimalistTUIC2CChatViewController_Minimalist *vc = [[TUIC2CChatViewController_Minimalist alloc] init];[vc setConversationData:data];// Add TUIC2CChatViewController to your own ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}@end
TUIC2CChatViewController_Minimalist
will automatically pull and display the historical messages of the user.#import "TUIC2CChatViewController.h"// ChatViewController is your own ViewController@implementation ChatViewController- (void)viewDidLoad {// Create conversation informationTUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];data.userID = @"userID";// TUIC2CChatViewControllerTUIC2CChatViewController *vc = [[TUIC2CChatViewController alloc] init];[vc setConversationData:data];// Add TUIC2CChatViewController to your own ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}@end
TUIC2CChatViewController
will automatically pull and display the historical messages of the user.#import "TUIContactController_Minimalist.h"// ContactController is your own ViewController@implementation ContactController- (void)viewDidLoad {// Create TUIContactController_MinimalistTUIContactController_Minimalist *vc = [[TUIContactController_Minimalist alloc] init];// Add TUIContactController_Minimalist to your own ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}@end
TUIContactController_Minimalist
and displays it. For the click actions (such as clicking a friend and adding a friend) on the contacts UI, TUIKit will deliver them to the upper layer for processing through ``TUIContactControllerListener_Minimalist`.@protocol TUIContactControllerListener_Minimalist <NSObject>@optional- (void)onSelectFriend:(TUICommonContactCell *)cell;- (void)onAddNewFriend:(TUICommonTableViewCell *)cell;- (void)onGroupConversation:(TUICommonTableViewCell *)cell;@end
#import "TUIContactController.h"// ContactController is your own ViewController@implementation ContactController- (void)viewDidLoad {// Create TUIContactControllerTUIContactController *vc = [[TUIContactController alloc] init];// Add TUIContactController to your own ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}@end
TUIContactController
and displays it. For the click actions (such as clicking a friend and adding a friend) on the contacts UI, TUIKit will deliver them to the upper layer for processing through TUIContactControllerListener
.@protocol TUIContactControllerListener <NSObject>@optional- (void)onSelectFriend:(TUICommonContactCell *)cell;- (void)onAddNewFriend:(TUICommonTableViewCell *)cell;- (void)onGroupConversation:(TUICommonTableViewCell *)cell;@end
#import "TUIFriendProfileController_Minimalist.h"- (void)onSelectFriend:(TUICommonContactCell *)cell{TUICommonContactCellData *data = cell.contactData;// Create the friend's profileTUIFriendProfileController_Minimalist *vc = [[TUIFriendProfileController_Minimalist alloc] init];vc.friendProfile = data.friendProfile;// Display the friend's profile[self.navigationController pushViewController:(UIViewController *)vc animated:YES];}
#import "TUIFriendProfileController.h"- (void)onSelectFriend:(TUICommonContactCell *)cell{TUICommonContactCellData *data = cell.contactData;// Create the friend's profileTUIFriendProfileController *vc = [[TUIFriendProfileController alloc] init];vc.friendProfile = data.friendProfile;// Display the friend's profile[self.navigationController pushViewController:(UIViewController *)vc animated:YES];}
Video Call | Audio Call |
| |
// Integrate the TUICallKit componentpod 'TUICallKit'
Starting a Call via a Message Page | Starting a Call via a Contact Profile Page |
| |
Voice Message Recorded by the System | Voice Message with AI-based Noise Reduction and Automatic Gain Control Recorded by TUICallkit |
| |
- Masonry (1.1.0)- MJExtension (3.4.1)- MJRefresh (3.7.5)- ReactiveObjC (3.1.1)- SDWebImage (5.18.11):- SDWebImage/Core (= 5.18.11)- SDWebImage/Core (5.18.11)- SnapKit (5.6.0)- SSZipArchive (2.4.3)
TXLiteAVSDK_TRTC
library, no symbol conflict will occur. You can directly add the dependency to the Podfile.pod 'TUICallKit'
TXLiteAVSDK_Professional
library, a symbol conflict will occur. You can add the dependency to the Podfile.pod 'TUICallKit/Professional'
TXLiteAVSDK_Enterprise
library, a symbol conflict will occur. It is recommended that you upgrade the version to TXLiteAVSDK_Professional
and then use TUICallKit/Professional
.pod
process, this is because TUIKit is using a third-party static library. You need to comment out use_frameworks!
in your Podfile.use_frameworks!
, use CocoaPods 1.9.0 or a later version for pod install
and modify it as follows:use_frameworks! :linkage => :static
Was this page helpful?