sudo gem install cocoapods
pod init
# Uncomment the next line to define a global platform for your projectsource 'https://github.com/CocoaPods/Specs.git'platform :ios, '13.0'# 防止 TUIKit 组件里的 *.xcassets 与您项目里面冲突。install! 'cocoapods', :disable_input_output_paths => true# 请使用您的真实项目名称替换 your_project_nametarget 'your_project_name' douse_frameworks!# 开启 modular headers。请按需开启,开启后 Pod 模块才能使用 @import 导入。# use_modular_headers!# 集成聊天功能pod 'TUIChat/UI_Minimalist'# 集成会话功能pod 'TUIConversation/UI_Minimalist'# 集成关系链功能pod 'TUIContact/UI_Minimalist'# 集成群组功能pod 'TUIGroup/UI_Minimalist'# 集成搜索功能(需要购买旗舰版套餐)pod 'TUISearch/UI_Minimalist'# 集成离线推送pod 'TUIOfflinePush'# 集成音视频通话功能pod 'TUICallKit'# 集成翻译插件,从 7.2 版本开始支持(需开通增值功能,请联系腾讯云商务开通)pod 'TUITranslationPlugin'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'# 防止 TUIKit 组件里的 *.xcassets 与您项目里面冲突。install! 'cocoapods', :disable_input_output_paths => true# 请使用您的真实项目名称替换 your_project_nametarget 'your_project_name' do# 从 7.1 版本开始,新增了 TUIKit 插件(TUIXXXPlugin),TUIKit 插件是动态库依赖,需要开启此设置。# 如果您不依赖 TUIKit 插件,该设置可以保持关闭。use_frameworks!# 请按需开启 modular headers,开启后 Pod 模块才能使用 @import 导入,简化 Swift 引用 OC 的方式。# use_modular_headers!# 集成聊天功能pod 'TUIChat/UI_Classic'# 集成会话功能pod 'TUIConversation/UI_Classic'# 集成关系链功能pod 'TUIContact/UI_Classic'# 集成群组功能pod 'TUIGroup/UI_Classic'# 集成搜索功能(需要购买旗舰版套餐)pod 'TUISearch/UI_Classic'# 集成音视频通话功能pod 'TUICallKit'# 集成快速会议pod 'TUIRoomKit'# 集成投票插件,从 7.1 版本开始支持pod 'TUIPollPlugin'# 集成群接龙插件,从 7.1 版本开始支持pod 'TUIGroupNotePlugin'# 集成翻译插件,从 7.2 版本开始支持(需开通增值功能,请联系腾讯云商务开通)pod 'TUITranslationPlugin'# 集成会话分组插件,从 7.3 版本开始支持pod 'TUIConversationGroupPlugin'# 集成会话标记插件,从 7.3 版本开始支持pod 'TUIConversationMarkPlugin'# 集成语音转文字插件,从 7.5 版本开始支持pod 'TUIVoiceToTextPlugin'# 集成客服插件,从 7.6 版本开始支持pod 'TUICustomerServicePlugin'# 集成机器人插件,从 7.7 版本开始支持pod 'TUIChatBotPlugin'# 集成消息推送插件,从 7.6 版本开始支持pod 'TIMPush'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'
,不指定经典版或简约版,默认会集成两套版本 UI 组件。 use_modular_headers!
,并将头文件引用改成 @import 模块名形式引用。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# 请使用您的真实项目名称替换 your_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!# 注意:使用本地集成方案时,如需升级时需要从# https://github.com/TencentCloud/TIMSDK/tree/master/iOS/TUIKit# 获取最新的组件代码,放置在本地指定目录下如/TIMSDK/ios/TUIKit/TUICore# 注意:当私有化修改和远端有冲突时,需要手动合并,处理冲突。# 集成基础库(必选)pod 'TUICore', :path => "../TUIKit/TUICore"pod 'TIMCommon', :path => "../TUIKit/TIMCommon"# 集成TUIKit组件(可选)# 集成聊天功能pod 'TUIChat', :path => "../TUIKit/TUIChat"# 集成会话功能pod 'TUIConversation', :path => "../TUIKit/TUIConversation"# 集成关系链功能pod 'TUIContact', :path => "../TUIKit/TUIContact"# 集成群组功能pod 'TUIGroup', :path => "../TUIKit/TUIGroup"# 集成搜索功能(需要购买旗舰版套餐)pod 'TUISearch', :path => "../TUIKit/TUISearch"# 集成离线推送pod 'TUIOfflinePush', :path => "../TUIKit/TUIOfflinePush"# 集成音视频通话功能pod 'TUICallKit'# 集成快速会议pod 'TUIRoomKit'# 集成TUIKitPlugin插件 (可选)# 注意: TUIKitPlugin插件需要跟随TUICore的版本# 需要确保插件版本和"../TUIKit/TUICore/TUICore.spec"中的spec.version一致# 集成投票插件,从 7.1 版本开始支持pod 'TUIPollPlugin', '7.6.5011'# 集成群接龙插件,从 7.1 版本开始支持pod 'TUIGroupNotePlugin', '7.6.5011'# 集成翻译插件,从 7.2 版本开始支持(需开通增值功能,请联系腾讯云商务开通)pod 'TUITranslationPlugin', '7.6.5011'# 集成会话分组插件,从 7.3 版本开始支持pod 'TUIConversationGroupPlugin', '7.6.5011'# 集成会话标记插件,从 7.3 版本开始支持pod 'TUIConversationMarkPlugin', '7.6.5011'# 其他 Podpod '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
#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(@"登录成功");} fail:^(int code, NSString *msg) {NSLog(@"登录失败");}];}
TUIConversationListController
对象即可。会话列表会从数据库中读取最近联系人,当用户点击联系人时,TUIConversationListController
将事件 didSelectConversation
回调给上层。#import "TUIConversationListController_Minimalist.h"// ConversationController 为您自己的 ViewController@implementation ConversationController- (void)viewDidLoad {[super viewDidLoad];// TUIConversationListController_MinimalistTUIConversationListController_Minimalist *vc = [[TUIConversationListController_Minimalist alloc] init];vc.delegate = self;// 把 TUIConversationListController_Minimalist 添加到自己的 ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}- (void)conversationListController:(TUIConversationListController_Minimalist *)conversationControllerdidSelectConversation:(TUIConversationCell *)conversation{// 会话列表点击事件,通常是打开聊天界面}@end
#import "TUIConversationListController.h"// ConversationController 为您自己的 ViewController@implementation ConversationController- (void)viewDidLoad {[super viewDidLoad];// TUIConversationListControllerTUIConversationListController *vc = [[TUIConversationListController alloc] init];vc.delegate = self;// 把 TUIConversationListController 添加到自己的 ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}- (void)conversationListController:(TUIConversationListController *)conversationControllerdidSelectConversation:(TUIConversationCell *)conversation{// 会话列表点击事件,通常是打开聊天界面}@end
#import "TUIC2CChatViewController_Minimalist.h"// ChatViewController 为您自己的 ViewController@implementation ChatViewController- (void)viewDidLoad {// 创建会话信息TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];data.userID = @"userID";// 创建 TUIC2CChatViewController_MinimalistTUIC2CChatViewController_Minimalist *vc = [[TUIC2CChatViewController_Minimalist alloc] init];[vc setConversationData:data];// 把 TUIC2CChatViewController 添加到自己的 ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}@end
TUIC2CChatViewController_Minimalist
会自动拉取该用户的历史消息并展示出来。#import "TUIC2CChatViewController.h"// ChatViewController 为您自己的 ViewController@implementation ChatViewController- (void)viewDidLoad {// 创建会话信息TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];data.userID = @"userID";// TUIC2CChatViewControllerTUIC2CChatViewController *vc = [[TUIC2CChatViewController alloc] init];[vc setConversationData:data];// 把 TUIC2CChatViewController 添加到自己的 ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}@end
TUIC2CChatViewController
会自动拉取该用户的历史消息并展示出来。#import "TUIContactController_Minimalist.h"// ContactController 为您自己的 ViewController@implementation ContactController- (void)viewDidLoad {// 创建 TUIContactController_MinimalistTUIContactController_Minimalist *vc = [[TUIContactController_Minimalist alloc] init];// 把 TUIContactController_Minimalist 添加到自己的 ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}@end
TUIContactController_Minimalist
初始化并展示出来,其中的点击行为(例如点击好友、添加好友等),TUIKit 会通过 TUIContactControllerListener_Minimalist
抛给上层处理:@protocol TUIContactControllerListener_Minimalist <NSObject>@optional- (void)onSelectFriend:(TUICommonContactCell *)cell;- (void)onAddNewFriend:(TUICommonTableViewCell *)cell;- (void)onGroupConversation:(TUICommonTableViewCell *)cell;@end
#import "TUIContactController.h"// ContactController 为您自己的 ViewController@implementation ContactController- (void)viewDidLoad {// 创建 TUIContactControllerTUIContactController *vc = [[TUIContactController alloc] init];// 把 TUIContactController 添加到自己的 ViewController[self addChildViewController:vc];[self.view addSubview:vc.view];}@end
TUIContactController
初始化并展示出来,其中的点击行为(例如点击好友、添加好友等),TUIKit 会通过 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;// 创建好友资料 vcTUIFriendProfileController_Minimalist *vc = [[TUIFriendProfileController_Minimalist alloc] init];vc.friendProfile = data.friendProfile;// 展示好友资料 vc[self.navigationController pushViewController:(UIViewController *)vc animated:YES];}
#import "TUIFriendProfileController.h"- (void)onSelectFriend:(TUICommonContactCell *)cell{TUICommonContactCellData *data = cell.contactData;// 创建好友资料 vcTUIFriendProfileController *vc = [[TUIFriendProfileController alloc] init];vc.friendProfile = data.friendProfile;// 展示好友资料 vc[self.navigationController pushViewController:(UIViewController *)vc animated:YES];}
视频通话 | 语音通话 |
| |
// 集成音视频通话组件pod '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
库,不会发生符号冲突。可直接在 Podfile 文件中添加依赖:pod 'TUICallKit'
TXLiteAVSDK_Professional
库,会产生符号冲突。您可在 Podfile 文件中添加依赖:pod 'TUICallKit/Professional'
TXLiteAVSDK_Enterprise
库,会产生符号冲突。建议升级到 TXLiteAVSDK_Professional
后使用 TUICallKit/Professional
。
本页内容是否解决了您的问题?