@tencentcloud/sdk-mcp 1.7.3 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +13 -13
- package/knowledge/path-meta.js +23 -1
- package/package.json +1 -1
- package/resource/index/manifest.json +1 -1
- package/resource/integration/callkit/preset/android/integration.md +4 -0
- package/resource/integration/callkit/preset/flutter/integration.md +4 -0
- package/resource/integration/callkit/preset/ios/integration.md +14 -13
- package/resource/integration/callkit/preset/vue/integration.md +0 -3
- package/resource/integration/chat/preset/android/integration.md +3 -145
- package/resource/integration/chat/preset/flutter/integration.md +20 -128
- package/resource/integration/chat/preset/ios/integration.md +2 -269
- package/resource/integration/chat/preset/react/integration.md +27 -1
- package/resource/integration/chat/preset/uni-app/integration.md +5 -1
- package/resource/integration/chat/preset/vue/integration.md +21 -31
- package/resource/integration/livekit/preset/live/android/live-host-integration.md +4 -0
- package/resource/integration/livekit/preset/live/ios/live-host-integration.md +4 -0
- package/resource/integration/livekit/preset/live/vue/live-list-integration.md +3 -4
- package/resource/integration/livekit/preset/live/vue/live-player-desk-integration.md +0 -1
- package/resource/integration/livekit/preset/live/vue/live-player-h5-integration.md +0 -1
- package/resource/integration/livekit/preset/live/vue/live-pusher-integration.md +4 -9
- package/resource/integration/roomkit/preset/vue/integration.md +0 -213
- package/resource/knowledge/callkit/best-practice/android/video-chat-dating.md +490 -0
- package/resource/knowledge/callkit/best-practice/flutter/android-keep-call-alive-background.md +79 -0
- package/resource/knowledge/callkit/best-practice/flutter/background-incoming-call-no-notification.md +99 -0
- package/resource/knowledge/callkit/best-practice/flutter/ios-keep-call-alive-background.md +93 -0
- package/resource/knowledge/callkit/best-practice/flutter/ios-startup-crash-version-voip.md +68 -0
- package/resource/knowledge/callkit/core-sdk/flutter/offline-push.md +1 -1
- package/resource/knowledge/callkit/core-sdk/ios/answer-call.md +9 -7
- package/resource/knowledge/callkit/core-sdk/ios/make-call.md +10 -7
- package/resource/knowledge/callkit/core-sdk/miniprogram/call-engine.md +19 -19
- package/resource/knowledge/callkit/core-sdk/miniprogram/call-event.md +16 -16
- package/resource/knowledge/callkit/core-sdk/uni-app/answer-call.md +0 -84
- package/resource/knowledge/callkit/core-sdk/uni-app/make-call.md +0 -102
- package/resource/knowledge/callkit/core-sdk/web/call-event.md +2 -2
- package/resource/knowledge/callkit/faq/error-code.md +62 -36
- package/resource/knowledge/callkit/faq/uniapp-miniprogram.md +1 -1
- package/resource/knowledge/callkit/preset/android/api.md +10 -10
- package/resource/knowledge/callkit/preset/harmonyos/api.md +362 -0
- package/resource/knowledge/callkit/preset/harmonyos/integration.md +322 -0
- package/resource/knowledge/callkit/preset/ios/api.md +9 -9
- package/resource/knowledge/callkit/preset/miniprogram/api-uniapp.md +293 -0
- package/resource/knowledge/callkit/preset/miniprogram/api.md +19 -19
- package/resource/knowledge/callkit/preset/miniprogram/integration.md +292 -0
- package/resource/knowledge/callkit/preset/miniprogram/uniapp-integration.md +521 -0
- package/resource/knowledge/callkit/preset/uni-app/api.md +49 -0
- package/resource/knowledge/callkit/preset/uni-app/integration.md +353 -0
- package/resource/knowledge/chat/preset/android-view/integration.md +52 -100
- package/resource/knowledge/chat/preset/ios/features/language.md +5 -5
- package/resource/knowledge/chat/preset/ios-uikit/integration.md +184 -923
- package/resource/knowledge/chat/preset/react/features/search.md +9 -214
- package/resource/knowledge/chat/preset/react/h5/integration.md +965 -0
- package/resource/knowledge/chat/preset/vue/features/chat-header.md +0 -36
- package/resource/knowledge/chat/preset/vue/features/contact-list.md +0 -34
- package/resource/knowledge/chat/preset/vue/features/conversation-list.md +0 -39
- package/resource/knowledge/chat/preset/vue/features/conversation-preview.md +0 -74
- package/resource/knowledge/chat/preset/vue/features/search.md +9 -790
- package/resource/knowledge/chat/preset/vue/h5/integration.md +724 -0
- package/resource/knowledge/livekit/core-sdk/features/uni-app/live-list.md +0 -167
- package/resource/knowledge/livekit/core-sdk/live/android/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/android/host-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/flutter/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/flutter/host-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/flutter/integration.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/ios/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/ios/host-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/ios/integration.md +2 -2
- package/resource/knowledge/livekit/core-sdk/live/uni-app/co-guest-interaction.md +1 -66
- package/resource/knowledge/livekit/core-sdk/live/uni-app/host-interaction.md +1 -66
- package/resource/knowledge/livekit/core-sdk/live/uni-app/integration.md +1 -1
- package/resource/knowledge/livekit/core-sdk/voice/android/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/voice/android/host-interaction.md +2 -2
- package/resource/knowledge/livekit/core-sdk/voice/flutter/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/voice/ios/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/voice/ios/host-interaction.md +2 -2
- package/resource/knowledge/livekit/core-sdk/voice/uni-app/integration.md +2 -2
- package/resource/knowledge/livekit/preset/live/vue/features/barrage.md +1 -24
- package/resource/knowledge/livekit/preset/live/vue/features/live-audience-list.md +0 -3
- package/resource/knowledge/livekit/preset/live/vue/features/live-view.md +0 -5
- package/resource/knowledge/push/api-reference/harmonyos.md +9 -9
- package/resource/knowledge/push/api-reference/unity.md +10 -10
- package/resource/knowledge/push/api-reference/unreal-engine.md +11 -11
- package/resource/knowledge/push/integration/android.md +57 -13
- package/resource/knowledge/push/integration/donut.md +3 -3
- package/resource/knowledge/push/integration/flutter.md +38 -24
- package/resource/knowledge/push/integration/harmonyos.md +1 -11
- package/resource/knowledge/push/integration/ios.md +21 -6
- package/resource/knowledge/push/integration/react-native.md +1 -1
- package/resource/knowledge/push/integration/uni-app.md +1 -1
- package/resource/knowledge/push/integration/unity.md +1 -1
- package/resource/knowledge/push/integration/unreal-engine.md +2 -2
- package/resource/knowledge/roomkit/core-sdk/android/room-state.md +3 -3
- package/resource/knowledge/roomkit/core-sdk/android/schedule-room.md +4 -4
- package/resource/knowledge/roomkit/core-sdk/flutter/room-state.md +2 -2
- package/resource/knowledge/roomkit/core-sdk/flutter/schedule-room.md +4 -4
- package/resource/knowledge/roomkit/core-sdk/ios/room-state.md +3 -3
- package/resource/knowledge/roomkit/core-sdk/ios/schedule-room.md +4 -4
- package/resource/knowledge/roomkit/core-sdk/vue/device-detection.md +0 -9
- package/resource/knowledge/roomkit/core-sdk/vue/free-beauty-panel.md +0 -9
- package/resource/knowledge/roomkit/core-sdk/vue/room-chat.md +0 -3
- package/resource/knowledge/roomkit/core-sdk/vue/room-view.md +0 -16
- package/resource/knowledge/roomkit/core-sdk/vue/schedule-room.md +0 -3
- package/resource/knowledge/roomkit/core-sdk/vue/virtual-background.md +0 -3
- package/resource/knowledge/roomkit/core-sdk/vue/whiteboard-annotation.md +0 -15
- package/resource/knowledge/roomkit/preset/android/integration.md +1 -202
- package/resource/knowledge/roomkit/preset/flutter/integration.md +13 -13
- package/resource/knowledge/roomkit/preset/harmonyos/integration.md +6 -2
- package/resource/knowledge/roomkit/preset/ios/integration.md +0 -201
- package/resource/knowledge/roomkit/preset/react/integration.md +0 -202
- package/resource/knowledge/roomkit/preset/uniapp-app/integration.md +207 -509
- package/resource/knowledge/rtcengine/web/plugin/42-advanced-realtime-transcriber.md +25 -6
- package/server.js +1 -1
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
TUIKit 是基于 IM SDK 的一款 UI 组件库,可通过 UI 组件快速实现聊天、会话、搜索、关系链、群组等功能。本文介绍如何快速集成 TUIKit 并实现核心功能。
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
- **经典版 UI**:从 5.7.1435 版本开始,TUIKit 支持模块化集成,支持了经典版 UI(类微信 UI)。
|
|
3
|
+
## 集成 TUIKit
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
TUIKit 采用数据驱动的响应式架构与原生 iOS View 体系(非 Compose),以源码方式开放集成。它提供会话列表、聊天、联系人、搜索、群组等完整 UI 能力。
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## 前提条件
|
|
7
|
+
### 前提条件
|
|
11
8
|
- Xcode 15 及以上
|
|
12
9
|
|
|
13
10
|
- iOS 14.0 及以上
|
|
@@ -18,1004 +15,262 @@ TUIKit 是基于 IM SDK 的一款 UI 组件库,可通过 UI 组件快速实现
|
|
|
18
15
|
|
|
19
16
|
- SDKSecretKey:应用的密钥。
|
|
20
17
|
|
|
21
|
-
##
|
|
22
|
-
|
|
23
|
-
> **消息引用与回复功能的版本兼容性:**
|
|
24
|
-
>
|
|
25
|
-
> 自 9.0.7652 版本起:
|
|
26
|
-
>
|
|
27
|
-
> - **消息引用(Quote)**改用 IMSDK 原生引用能力实现,与旧版本引用消息格式不兼容。新旧版本互发的引用消息无法正确解析引用内容,请将收发双方统一升级至 9.0.7652 及以上版本。
|
|
28
|
-
> - **消息回复(Reply)**功能已下线,相关接口与 UI 入口不再提供,如业务有相关需求,可参考旧版本 TUIKit 自行实现。
|
|
29
|
-
> **两者区别:引用是发送新消息时附带一条历史消息的摘要卡片,点击可跳转原消息(一问一答);回复是在某条消息下追加评论并聚合成回复列表(评论区式)。**
|
|
30
|
-
>
|
|
31
|
-
|
|
32
|
-
1. 安装 CocoaPods。
|
|
33
|
-
在终端窗口中输入如下命令(需要提前在 Mac 中安装 Ruby 环境):
|
|
34
|
-
|
|
35
|
-
``` bash
|
|
36
|
-
sudo gem install cocoapods
|
|
37
|
-
```
|
|
38
|
-
2. 创建 Podfile 文件。
|
|
39
|
-
进入项目所在路径输入以下命令行,之后项目路径下会出现一个 Podfile 文件。
|
|
40
|
-
|
|
41
|
-
``` bash
|
|
42
|
-
pod init
|
|
43
|
-
```
|
|
44
|
-
3. 根据业务需求在 Podfile 中添加对应的 TUIKit 组件。组件之间相互独立,添加或删除均不影响工程编译。您可以按需选择不同的 Podfile 集成方式:
|
|
45
|
-
|
|
46
|
-
- 远程 CocoaPods 集成。
|
|
47
|
-
|
|
48
|
-
- DevelopmentPods 本地集成。
|
|
18
|
+
## 集成并引入组件
|
|
49
19
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|集成方式|适合场景|优点|缺点|
|
|
53
|
-
|---------|---------|---------|---------|
|
|
54
|
-
|远程 CocoaPods 集成|适合无源码修改时的集成。|当 TUIKit 有版本更新时,您只需再次 `Pod update` 即可完成更新。|当您有源码修改,使用 `Pod update` 更新时,新版本的 TUIKit 会覆盖您的修改。|
|
|
55
|
-
|本地 DevelopmentPods 集成|适合有涉及源码自定义修改的客户。|当您有自己的 git 仓库时,可以跟踪修改。修改源码后,使用 `Pod update` 更新其他远程 Pod 库时,不会覆盖您的修改。|您需要手动将 TUIKit 源码覆盖您本地 TUIKit 文件夹进行更新。|
|
|
56
|
-
|
|
57
|
-
### 远程 CocoaPods 集成
|
|
58
|
-
|
|
59
|
-
您可以在 Podfile 中按需添加组件库:
|
|
60
|
-
|
|
61
|
-
> **注意:**
|
|
62
|
-
> 从 8.5.6870 版本开始,TUIKit 支持 Swift 语言组件。
|
|
20
|
+
> **说明:**
|
|
21
|
+
> Demo:[GitHub 完整 Demo](https://github.com/Tencent-RTC/TUIKit_iOS) 开箱即用,[5 分钟跑通聊天 + 音视频通话全功能](https://cloud.tencent.com/document/product/269/68228)。
|
|
63
22
|
>
|
|
64
23
|
|
|
65
|
-
|
|
24
|
+
### 下载源码
|
|
66
25
|
|
|
67
|
-
|
|
26
|
+
从 GitHub 下载 [TUIKit iOS](https://github.com/Tencent-RTC/TUIKit_iOS) 源码:
|
|
68
27
|
``` bash
|
|
69
|
-
|
|
70
|
-
source 'https://github.com/CocoaPods/Specs.git'
|
|
71
|
-
platform :ios, '14.0'
|
|
72
|
-
# 防止 TUIKit 组件里的 *.xcassets 与您项目里面冲突。
|
|
73
|
-
install! 'cocoapods', :disable_input_output_paths => true
|
|
74
|
-
|
|
75
|
-
# 请使用您的真实项目名称替换 your_project_name
|
|
76
|
-
target 'your_project_name' do
|
|
77
|
-
use_frameworks!
|
|
78
|
-
use_modular_headers!
|
|
79
|
-
|
|
80
|
-
# 集成聊天功能
|
|
81
|
-
pod 'TUIChat_Swift/UI_Classic'
|
|
82
|
-
# 集成会话功能
|
|
83
|
-
pod 'TUIConversation_Swift/UI_Classic'
|
|
84
|
-
# 集成关系链功能
|
|
85
|
-
pod 'TUIContact_Swift/UI_Classic'
|
|
86
|
-
# 集成搜索功能(需要购买旗舰版或企业版套餐)
|
|
87
|
-
pod 'TUISearch_Swift/UI_Classic'
|
|
88
|
-
# 集成音视频通话功能
|
|
89
|
-
pod 'TUICallKit_Swift'
|
|
90
|
-
# 集成投票插件
|
|
91
|
-
pod 'TUIPollPlugin_Swift'
|
|
92
|
-
# 集成群接龙插件
|
|
93
|
-
pod 'TUIGroupNotePlugin_Swift'
|
|
94
|
-
# 集成翻译插件(需开通增值功能,请联系腾讯云商务开通)
|
|
95
|
-
pod 'TUITranslationPlugin_Swift'
|
|
96
|
-
# 集成会话分组插件
|
|
97
|
-
pod 'TUIConversationGroupPlugin_Swift'
|
|
98
|
-
# 集成会话标记插件
|
|
99
|
-
pod 'TUIConversationMarkPlugin_Swift'
|
|
100
|
-
# 集成语音转文字插件
|
|
101
|
-
pod 'TUIVoiceToTextPlugin_Swift'
|
|
102
|
-
# 集成文字转语音插件
|
|
103
|
-
pod 'TUITextToVoicePlugin_Swift'
|
|
104
|
-
# 集成公众号插件
|
|
105
|
-
pod 'TUIOfficialAccountPlugin_Swift'
|
|
106
|
-
# 集成表情回应插件
|
|
107
|
-
pod 'TUIEmojiPlugin_Swift'
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
#Pods config
|
|
111
|
-
post_install do |installer|
|
|
112
|
-
installer.pods_project.targets.each do |target|
|
|
113
|
-
target.build_configurations.each do |config|
|
|
114
|
-
#Fix Xcode14 Bundle target error
|
|
115
|
-
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
|
|
116
|
-
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
|
|
117
|
-
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
|
|
118
|
-
config.build_settings['ENABLE_BITCODE'] = "NO"
|
|
119
|
-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "14.0"
|
|
120
|
-
#Fix Xcode15 other links flag -ld64
|
|
121
|
-
xcode_version = `xcrun xcodebuild -version | grep Xcode | cut -d' ' -f2`.to_f
|
|
122
|
-
if xcode_version >= 15
|
|
123
|
-
xcconfig_path = config.base_configuration_reference.real_path
|
|
124
|
-
xcconfig = File.read(xcconfig_path)
|
|
125
|
-
if xcconfig.include?("OTHER_LDFLAGS") == false
|
|
126
|
-
xcconfig = xcconfig + "\n" + 'OTHER_LDFLAGS = $(inherited) "-ld64"'
|
|
127
|
-
else
|
|
128
|
-
if xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == false
|
|
129
|
-
xcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")
|
|
130
|
-
end
|
|
131
|
-
if xcconfig.include?("-ld64") == false
|
|
132
|
-
xcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld64"')
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
File.open(xcconfig_path, "w") { |file| file << xcconfig }
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
end
|
|
28
|
+
git clone https://github.com/Tencent-RTC/TUIKit_iOS.git
|
|
140
29
|
```
|
|
141
30
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
【Swift 组件】
|
|
31
|
+
将仓库根目录下的 `chat`、`call` 文件夹整体复制到您的工程根目录下。复制完成后的目录结构如下:
|
|
145
32
|
``` bash
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
#
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
use_modular_headers!
|
|
156
|
-
|
|
157
|
-
# 集成聊天功能
|
|
158
|
-
pod 'TUIChat_Swift/UI_Minimalist'
|
|
159
|
-
# 集成会话功能
|
|
160
|
-
pod 'TUIConversation_Swift/UI_Minimalist'
|
|
161
|
-
# 集成关系链功能
|
|
162
|
-
pod 'TUIContact_Swift/UI_Minimalist'
|
|
163
|
-
# 集成搜索功能(需要购买旗舰版或企业版、套餐)
|
|
164
|
-
pod 'TUISearch_Swift/UI_Minimalist'
|
|
165
|
-
# 集成音视频通话功能
|
|
166
|
-
pod 'TUICallKit_Swift'
|
|
167
|
-
# 集成翻译插件(需单独购买翻译插件)
|
|
168
|
-
pod 'TUITranslationPlugin_Swift'
|
|
169
|
-
# 集成语音转文字插件
|
|
170
|
-
pod 'TUIVoiceToTextPlugin_Swift'
|
|
171
|
-
# 集成表情回应插件
|
|
172
|
-
pod 'TUIEmojiPlugin_Swift'
|
|
173
|
-
end
|
|
174
|
-
#Pods config
|
|
175
|
-
post_install do |installer|
|
|
176
|
-
installer.pods_project.targets.each do |target|
|
|
177
|
-
target.build_configurations.each do |config|
|
|
178
|
-
#Fix Xcode14 Bundle target error
|
|
179
|
-
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
|
|
180
|
-
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
|
|
181
|
-
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
|
|
182
|
-
config.build_settings['ENABLE_BITCODE'] = "NO"
|
|
183
|
-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "14.0"
|
|
184
|
-
#Fix Xcode15 other links flag -ld64
|
|
185
|
-
xcode_version = `xcrun xcodebuild -version | grep Xcode | cut -d' ' -f2`.to_f
|
|
186
|
-
if xcode_version >= 15
|
|
187
|
-
xcconfig_path = config.base_configuration_reference.real_path
|
|
188
|
-
xcconfig = File.read(xcconfig_path)
|
|
189
|
-
if xcconfig.include?("OTHER_LDFLAGS") == false
|
|
190
|
-
xcconfig = xcconfig + "\n" + 'OTHER_LDFLAGS = $(inherited) "-ld64"'
|
|
191
|
-
else
|
|
192
|
-
if xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == false
|
|
193
|
-
xcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")
|
|
194
|
-
end
|
|
195
|
-
if xcconfig.include?("-ld64") == false
|
|
196
|
-
xcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld64"')
|
|
197
|
-
end
|
|
198
|
-
end
|
|
199
|
-
File.open(xcconfig_path, "w") { |file| file << xcconfig }
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
end
|
|
33
|
+
YourApplication/
|
|
34
|
+
├── app/ # 您的应用模块
|
|
35
|
+
├── call/ # 音视频通话组件
|
|
36
|
+
│ └── TUICallKit_Swift.podspec
|
|
37
|
+
│ └── TUICallKit_Swift/
|
|
38
|
+
├── chat/ # Chat 源码
|
|
39
|
+
│ ├── demo/ # 示例工程
|
|
40
|
+
│ └── uikit/ # Chat UIKit 组件库
|
|
41
|
+
├── Podfile
|
|
204
42
|
```
|
|
205
43
|
|
|
206
44
|
> **说明:**
|
|
207
|
-
>
|
|
208
|
-
> 2. 经典版和简约版 UI 不能混用,集成多个组件时,您必须同时全部选择经典版 UI 或简约版 UI。例如,经典版 `TUIChat` 组件必须与经典版 `TUIConversation`、`TUIContact` 组件搭配使用。同理,简约版 `TUIChat` 组件必须与简约版 `TUIConversation`、`TUIContact` 组件搭配使用。
|
|
209
|
-
|
|
210
|
-
Podfile 修改完毕后,执行以下命令,安装 TUIKit 组件。
|
|
211
|
-
``` bash
|
|
212
|
-
pod install
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
如果无法安装 TUIKit 最新版本,执行以下命令更新本地的 CocoaPods 仓库列表。
|
|
216
|
-
``` bash
|
|
217
|
-
pod repo update
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
之后执行以下命令,更新组件库的 Pod 版本。
|
|
221
|
-
``` bash
|
|
222
|
-
pod update
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
集成全部的 TUIKit 组件后的项目结构:
|
|
226
|
-
|
|
227
|
-
### 本地 DevelopmentPods 源码集成
|
|
228
|
-
|
|
229
|
-
> **消息引用与回复功能的版本兼容性:**
|
|
230
|
-
>
|
|
231
|
-
> 自 9.0.7652 版本起:
|
|
45
|
+
> TUIKit_iOS 是包含多个产品的开源仓库,Chat 的 UI 源码位于 `chat/` 目录下(`chat/uikit` 为 UIKit 组件库,`chat/demo` 为示例工程),其依赖的音视频通话组件 `call/TUICallkit_Swift` 位于仓库根目录。模块目录可放在工程任意位置,只需在 `Podfile` 中设置正确的相对路径即可。
|
|
232
46
|
>
|
|
233
|
-
> - 消息引用(Quote) 改用 IMSDK 原生引用能力实现,与旧版本引用消息格式不兼容。新旧版本互发的引用消息无法正确解析引用内容,请将收发双方统一升级至 9.0.7652 及以上版本。
|
|
234
|
-
> - 消息回复(Reply) 功能已下线,相关接口与 UI 入口不再提供,如业务有相关需求,可参考旧版本 TUIKit 自行实现。
|
|
235
|
-
> *两者区别:引用是发送新消息时附带一条历史消息的摘要卡片,点击可跳转原消息(一问一答);回复是在某条消息下追加评论并聚合成回复列表(评论区式)。*
|
|
236
|
-
>
|
|
237
|
-
|
|
238
|
-
1. 从 GitHub 下载 TUIKit 源码,将 TUIKit 目录直接拖入您的工程目录下:
|
|
239
|
-
|
|
240
|
-
- [Swift TUIKit 源码 GitHub 地址](https://github.com/Tencent-RTC/Chat_UIKit/tree/main/Swift/TUIKit):
|
|
241
|
-
|
|
242
|
-
- [Objective-C TUIKit 源码 GitHub 地址](https://github.com/TencentCloud/TIMSDK/tree/master/iOS/TUIKit):
|
|
243
|
-
|
|
244
|
-
2. 修改您 Podfile 中每个组件的本地路径。path 是 TUIKit 文件夹相对于您工程 Podfile 文件的位置,常见的有:
|
|
245
|
-
|
|
246
|
-
- TUIKit 文件夹位于您工程 Podfile 文件**父目录**: `pod 'TUICore', :path => "../TUIKit/TUICore"`
|
|
247
|
-
|
|
248
|
-
- TUIKit 文件夹位于您工程 Podfile 文件**当前目录**: `pod 'TUICore', :path => "./TUIKit/TUICore"`
|
|
249
47
|
|
|
250
|
-
|
|
48
|
+
### 集成组件
|
|
49
|
+
1. 在 Podfile 中引入对应模块(请按源码实际存放位置调整相对路径):
|
|
251
50
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
【Swift 组件】
|
|
257
|
-
``` bash
|
|
258
|
-
# Uncomment the next line to define a global platform for your project
|
|
259
|
-
source 'https://github.com/CocoaPods/Specs.git'
|
|
260
|
-
platform :ios, '14.0'
|
|
261
|
-
install! 'cocoapods', :disable_input_output_paths => true
|
|
262
|
-
|
|
263
|
-
# 请使用您的真实项目名称替换 your_project_name
|
|
264
|
-
target 'your_project_name' do
|
|
265
|
-
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
|
|
266
|
-
use_frameworks!
|
|
267
|
-
use_modular_headers!
|
|
268
|
-
|
|
269
|
-
# 集成基础库(必选)
|
|
270
|
-
pod 'TUICore', :path => "../TUIKit/TUICore"
|
|
271
|
-
pod 'TIMCommon_Swift', :path => "../TUIKit/TIMCommon"
|
|
272
|
-
# 集成TUIKit组件(可选)
|
|
273
|
-
# 集成聊天功能
|
|
274
|
-
pod 'TUIChat_Swift', :path => "../TUIKit/TUIChat"
|
|
275
|
-
# 集成会话功能
|
|
276
|
-
pod 'TUIConversation_Swift', :path => "../TUIKit/TUIConversation"
|
|
277
|
-
# 集成关系链功能
|
|
278
|
-
pod 'TUIContact_Swift', :path => "../TUIKit/TUIContact"
|
|
279
|
-
# 集成搜索功能(需要购买旗舰版或企业版套餐)
|
|
280
|
-
pod 'TUISearch_Swift', :path => "../TUIKit/TUISearch"
|
|
281
|
-
|
|
282
|
-
# 集成音视频通话功能
|
|
283
|
-
pod 'TUICallKit_Swift'
|
|
284
|
-
|
|
285
|
-
# 集成 TUIKitPlugin 插件 (可选)
|
|
286
|
-
# 集成翻译插件(需单独购买插件)
|
|
287
|
-
pod 'TUITranslationPlugin_Swift'
|
|
288
|
-
# 集成语音转文字插件(需单独购买插件)
|
|
289
|
-
pod 'TUIVoiceToTextPlugin_Swift'
|
|
290
|
-
|
|
291
|
-
# 其他 Pod
|
|
292
|
-
pod 'MJRefresh'
|
|
293
|
-
pod 'SnapKit'
|
|
294
|
-
end
|
|
295
|
-
#Pods config
|
|
296
|
-
post_install do |installer|
|
|
297
|
-
installer.pods_project.targets.each do |target|
|
|
298
|
-
target.build_configurations.each do |config|
|
|
299
|
-
#Fix Xcode14 Bundle target error
|
|
300
|
-
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
|
|
301
|
-
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
|
|
302
|
-
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
|
|
303
|
-
config.build_settings['ENABLE_BITCODE'] = "NO"
|
|
304
|
-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "14.0"
|
|
305
|
-
#Fix Xcode15 other links flag -ld64
|
|
306
|
-
xcode_version = `xcrun xcodebuild -version | grep Xcode | cut -d' ' -f2`.to_f
|
|
307
|
-
if xcode_version >= 15
|
|
308
|
-
xcconfig_path = config.base_configuration_reference.real_path
|
|
309
|
-
xcconfig = File.read(xcconfig_path)
|
|
310
|
-
if xcconfig.include?("OTHER_LDFLAGS") == false
|
|
311
|
-
xcconfig = xcconfig + "\n" + 'OTHER_LDFLAGS = $(inherited) "-ld64"'
|
|
312
|
-
else
|
|
313
|
-
if xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == false
|
|
314
|
-
xcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")
|
|
315
|
-
end
|
|
316
|
-
if xcconfig.include?("-ld64") == false
|
|
317
|
-
xcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld64"')
|
|
318
|
-
end
|
|
319
|
-
end
|
|
320
|
-
File.open(xcconfig_path, "w") { |file| file << xcconfig }
|
|
321
|
-
end
|
|
322
|
-
end
|
|
323
|
-
end
|
|
324
|
-
end
|
|
325
|
-
```
|
|
51
|
+
``` bash
|
|
52
|
+
# 请使用您的真实项目名称替换 your_project_name
|
|
53
|
+
target 'your_project_name' do
|
|
326
54
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
platform :ios, '14.0'
|
|
332
|
-
install! 'cocoapods', :disable_input_output_paths => true
|
|
333
|
-
|
|
334
|
-
# 请使用您的真实项目名称替换 your_project_name
|
|
335
|
-
target 'your_project_name' do
|
|
336
|
-
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
|
|
337
|
-
use_frameworks!
|
|
338
|
-
use_modular_headers!
|
|
339
|
-
|
|
340
|
-
# 集成基础库(必选)
|
|
341
|
-
pod 'TUICore', :path => "../TUIKit/TUICore"
|
|
342
|
-
pod 'TIMCommon', :path => "../TUIKit/TIMCommon"
|
|
343
|
-
# 集成TUIKit组件(可选)
|
|
344
|
-
# 集成聊天功能
|
|
345
|
-
pod 'TUIChat', :path => "../TUIKit/TUIChat"
|
|
346
|
-
# 集成会话功能
|
|
347
|
-
pod 'TUIConversation', :path => "../TUIKit/TUIConversation"
|
|
348
|
-
# 集成关系链功能
|
|
349
|
-
pod 'TUIContact', :path => "../TUIKit/TUIContact"
|
|
350
|
-
# 集成搜索功能(需要购买旗舰版或企业版套餐)
|
|
351
|
-
pod 'TUISearch', :path => "../TUIKit/TUISearch"
|
|
352
|
-
|
|
353
|
-
# 集成音视频通话功能
|
|
354
|
-
pod 'TUICallKit_Swift'
|
|
355
|
-
# 集成快速会议
|
|
356
|
-
pod 'TUIRoomKit'
|
|
357
|
-
|
|
358
|
-
# 集成TUIKitPlugin插件 (可选)
|
|
359
|
-
# 集成翻译插件,从 7.2 版本开始支持(需单独购买翻译插件)
|
|
360
|
-
pod 'TUITranslationPlugin'
|
|
361
|
-
# 集成推送插件
|
|
362
|
-
pod 'TIMPush'
|
|
363
|
-
|
|
364
|
-
# 其他 Pod
|
|
365
|
-
pod 'MJRefresh'
|
|
366
|
-
pod 'Masonry'
|
|
367
|
-
end
|
|
368
|
-
#Pods config
|
|
369
|
-
post_install do |installer|
|
|
370
|
-
installer.pods_project.targets.each do |target|
|
|
371
|
-
target.build_configurations.each do |config|
|
|
372
|
-
#Fix Xcode14 Bundle target error
|
|
373
|
-
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
|
|
374
|
-
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
|
|
375
|
-
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
|
|
376
|
-
config.build_settings['ENABLE_BITCODE'] = "NO"
|
|
377
|
-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "14.0"
|
|
378
|
-
#Fix Xcode15 other links flag -ld64
|
|
379
|
-
xcode_version = `xcrun xcodebuild -version | grep Xcode | cut -d' ' -f2`.to_f
|
|
380
|
-
if xcode_version >= 15
|
|
381
|
-
xcconfig_path = config.base_configuration_reference.real_path
|
|
382
|
-
xcconfig = File.read(xcconfig_path)
|
|
383
|
-
if xcconfig.include?("OTHER_LDFLAGS") == false
|
|
384
|
-
xcconfig = xcconfig + "\n" + 'OTHER_LDFLAGS = $(inherited) "-ld64"'
|
|
385
|
-
else
|
|
386
|
-
if xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == false
|
|
387
|
-
xcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")
|
|
388
|
-
end
|
|
389
|
-
if xcconfig.include?("-ld64") == false
|
|
390
|
-
xcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld64"')
|
|
391
|
-
end
|
|
392
|
-
end
|
|
393
|
-
File.open(xcconfig_path, "w") { |file| file << xcconfig }
|
|
394
|
-
end
|
|
395
|
-
end
|
|
396
|
-
end
|
|
397
|
-
end
|
|
398
|
-
```
|
|
55
|
+
# 补充如下内容 增加 ChatUIKit 和 TUICallKit_Swift 这两个依赖
|
|
56
|
+
pod 'ChatUIKit', :path => 'chat/uikit/ChatUIKit.podspec'
|
|
57
|
+
pod 'TUICallKit_Swift', :path => 'call/TUICallKit_Swift.podspec'
|
|
58
|
+
end
|
|
399
59
|
|
|
400
|
-
|
|
60
|
+
```
|
|
61
|
+
2. Podfile 修改完毕后,执行以下命令,安装 TUIKit 组件。
|
|
401
62
|
|
|
402
63
|
``` bash
|
|
403
64
|
pod install
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
> **注意:**
|
|
407
|
-
>
|
|
408
|
-
> 1. 使用本地集成方案时,如需升级时需要从 GitHub 获取最新的组件代码,覆盖您本地项目的 TUIKit 目录。
|
|
409
|
-
> 2. 当私有化修改和远端有冲突时,需要手动合并,处理冲突。
|
|
410
|
-
> 3. TUIKit 插件需要依赖 TUICore 的版本,请确保插件版本和 "../TUIKit/TUICore/TUICore.spec" 中的 spec.version 一致。
|
|
411
65
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
【Swift 组件】
|
|
417
|
-
``` plaintext
|
|
418
|
-
- MJExtension (3.4.1)
|
|
419
|
-
- MJRefresh (3.7.5)
|
|
420
|
-
- SnapKit (5.7.1)
|
|
421
|
-
- SSZipArchive (2.4.3)
|
|
422
|
-
- SDWebImage (5.18.11)
|
|
423
|
-
```
|
|
66
|
+
# 如果无法安装 TUIKit 最新版本,执行以下命令更新本地的 CocoaPods 仓库列表。
|
|
67
|
+
# pod repo update
|
|
68
|
+
# pod update
|
|
424
69
|
|
|
425
|
-
|
|
426
|
-
``` plaintext
|
|
427
|
-
- Masonry (1.1.0)
|
|
428
|
-
- MJExtension (3.4.1)
|
|
429
|
-
- MJRefresh (3.7.5)
|
|
430
|
-
- ReactiveObjC (3.1.1)
|
|
431
|
-
- SDWebImage (5.18.11):
|
|
432
|
-
- SDWebImage/Core (= 5.18.11)
|
|
433
|
-
- SDWebImage/Core (5.18.11)
|
|
434
|
-
- SnapKit (5.6.0)
|
|
435
|
-
- SSZipArchive (2.4.3)
|
|
436
|
-
```
|
|
70
|
+
```
|
|
437
71
|
|
|
438
72
|
## 接入步骤
|
|
439
73
|
|
|
440
|
-
|
|
74
|
+
完成上述集成后,参考以下步骤,您仅需几行代码即可在项目中快速搭建会话列表、聊天、联系人等核心界面
|
|
441
75
|
|
|
442
76
|
### 步骤1:配置用户鉴权
|
|
443
77
|
|
|
444
|
-
|
|
78
|
+
在 [即时通信 IM 控制台](https://console.cloud.tencent.com/im/tool-usersig) 根据 UserID 获取 UserSig,用于后续登录时的用户鉴权。
|
|
445
79
|
|
|
446
80
|
### 步骤2:用户登录
|
|
447
81
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
示例代码如下所示:
|
|
451
|
-
|
|
452
|
-
【Swift】
|
|
453
|
-
``` swift
|
|
454
|
-
import TUICore
|
|
455
|
-
@objc func loginSDK(_ userID: String, userSig: String, succ: TSucc?, fail: TFail?) {
|
|
456
|
-
TUILogin.login(Int32(SDKAPPID), userID: userID, userSig: userSig, config: loginConfig, succ: {
|
|
457
|
-
// update UI
|
|
458
|
-
succ?()
|
|
459
|
-
}, fail: { code, msg in
|
|
460
|
-
// update UI
|
|
461
|
-
fail?(code, msg)
|
|
462
|
-
})
|
|
463
|
-
}
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
【Objective-C】
|
|
467
|
-
``` objectivec
|
|
468
|
-
#import "TUILogin.h"
|
|
469
|
-
|
|
470
|
-
- (void)loginSDK:(NSString *)userID userSig:(NSString *)sig succ:(TSucc)succ fail:(TFail)fail {
|
|
471
|
-
[TUILogin login:SDKAppID userID:userID userSig:sig succ:^{
|
|
472
|
-
NSLog(@"登录成功");
|
|
473
|
-
} fail:^(int code, NSString *msg) {
|
|
474
|
-
NSLog(@"登录失败");
|
|
475
|
-
}];
|
|
476
|
-
}
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
### 步骤3:构建会话列表界面
|
|
480
|
-
|
|
481
|
-
会话列表只需要创建 `TUIConversationListController` 对象即可。会话列表会从数据库中读取最近联系人,当用户点击联系人时,`TUIConversationListController` 将事件 `didSelectConversation` 回调给上层。
|
|
482
|
-
|
|
483
|
-
示例代码如下所示:
|
|
484
|
-
|
|
485
|
-
【经典版】
|
|
82
|
+
登录鉴权后才能正常使用组件的功能。调用 `LoginStore` 的 `login` 接口,传入上文获取的 sdkAppID、userID、userSig 进行登录鉴权:
|
|
486
83
|
|
|
487
84
|
【Swift】
|
|
488
85
|
``` swift
|
|
86
|
+
import AtomicXCore
|
|
87
|
+
import ChatUIKit
|
|
489
88
|
import UIKit
|
|
490
|
-
import TUICore
|
|
491
|
-
import ImSDK_Plus
|
|
492
|
-
import TIMCommon
|
|
493
|
-
import TUIConversation
|
|
494
|
-
// ConversationController 为您自己的 ViewController
|
|
495
|
-
public class ConversationController: UIViewController, V2TIMSDKListener, TUIPopViewDelegate {
|
|
496
|
-
private var conv: TUIConversationListController?
|
|
497
|
-
override public func viewDidLoad() {
|
|
498
|
-
super.viewDidLoad()
|
|
499
|
-
setupNavigation()
|
|
500
|
-
conv = TUIConversationListController()
|
|
501
|
-
if let conv = conv {
|
|
502
|
-
addChild(conv)
|
|
503
|
-
view.addSubview(conv.view)
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
// 会话列表点击事件,可自定义,通常是打开聊天界面
|
|
508
|
-
public protocol TUIConversationListControllerListener: AnyObject {
|
|
509
|
-
func conversationListController(_ conversationController: UIViewController, didSelectConversation conversation: TUIConversationCellData) -> Bool
|
|
510
|
-
}
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
【Objective-C】
|
|
514
|
-
``` objectivec
|
|
515
|
-
#import "TUIConversationListController.h"
|
|
516
|
-
|
|
517
|
-
// ConversationController 为您自己的 ViewController
|
|
518
|
-
@implementation ConversationController
|
|
519
|
-
- (void)viewDidLoad {
|
|
520
|
-
[super viewDidLoad];
|
|
521
|
-
// TUIConversationListController
|
|
522
|
-
TUIConversationListController *vc = [[TUIConversationListController alloc] init];
|
|
523
|
-
vc.delegate = self;
|
|
524
|
-
// 把 TUIConversationListController 添加到自己的 ViewController
|
|
525
|
-
[self addChildViewController:vc];
|
|
526
|
-
[self.view addSubview:vc.view];
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
- (void)conversationListController:(UIViewController *)conversationController
|
|
530
|
-
didSelectConversation:(TUIConversationCellData *)conversation {
|
|
531
|
-
// 会话列表点击事件,可自定义,通常是打开聊天界面
|
|
532
|
-
}
|
|
533
|
-
@end
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
【简约版】
|
|
537
89
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
//
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
90
|
+
let youSdkAppID: Int32 = 10_000_000_00 // 填写你的实际sdkAppID
|
|
91
|
+
let testUserID = "testUserID" // 你的测试用户ID
|
|
92
|
+
let userSig = "xxxxxxx" // 你的测试用户ID对应的 userSig (从IM 控制台获取,看上面的截图)
|
|
93
|
+
|
|
94
|
+
LoginStore.shared.login(sdkAppID: youSdkAppID, userID: testUserID, userSig: userSig) { [weak self] result in
|
|
95
|
+
DispatchQueue.main.async {
|
|
96
|
+
switch result {
|
|
97
|
+
case .success:
|
|
98
|
+
// 登录成功后 显示会话列表
|
|
99
|
+
// self?.showConversationList()
|
|
100
|
+
case .failure(let error):
|
|
101
|
+
print("login failed: \(error.code) \(error.message)")
|
|
550
102
|
}
|
|
551
103
|
}
|
|
552
104
|
}
|
|
553
|
-
// 会话列表点击事件,可自定义,通常是打开聊天界面
|
|
554
|
-
public protocol TUIConversationListControllerListener: AnyObject {
|
|
555
|
-
func conversationListController(_ conversationController: UIViewController, didSelectConversation conversation: TUIConversationCellData) -> Bool
|
|
556
|
-
}
|
|
557
105
|
```
|
|
558
106
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
// ConversationController 为您自己的 ViewController
|
|
564
|
-
@implementation ConversationController
|
|
565
|
-
- (void)viewDidLoad {
|
|
566
|
-
[super viewDidLoad];
|
|
567
|
-
// TUIConversationListController_Minimalist
|
|
568
|
-
TUIConversationListController_Minimalist *vc = [[TUIConversationListController_Minimalist alloc] init];
|
|
569
|
-
vc.delegate = self;
|
|
570
|
-
// 把 TUIConversationListController_Minimalist 添加到自己的 ViewController
|
|
571
|
-
[self addChildViewController:vc];
|
|
572
|
-
[self.view addSubview:vc.view];
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
- (void)conversationListController:(TUIConversationListController_Minimalist *)conversationController
|
|
576
|
-
didSelectConversation:(TUIConversationCell *)conversation
|
|
577
|
-
{
|
|
578
|
-
// 会话列表点击事件,通常是打开聊天界面
|
|
579
|
-
}
|
|
580
|
-
@end
|
|
581
|
-
```
|
|
582
|
-
|
|
583
|
-
### 步骤4:构建聊天界面
|
|
584
|
-
|
|
585
|
-
初始化聊天界面时,需要上层传入当前聊天界面对应的会话信息。
|
|
107
|
+
> **注意**:
|
|
108
|
+
>
|
|
109
|
+
> 在正式的生产环境中,建议在您的服务端生成 UserSig,在需要时由 App 向业务服务器发起请求获取动态 UserSig 进行鉴权。详见 [服务端生成 UserSig](https://cloud.tencent.com/document/product/269/32688)。
|
|
110
|
+
>
|
|
586
111
|
|
|
587
|
-
|
|
112
|
+
### 步骤3:构建会话列表界面
|
|
588
113
|
|
|
589
|
-
|
|
114
|
+
登录成功后(步骤 2),即可展示会话列表。只需创建 `ConversationsPage` 对象,并将其 push 到导航控制器:
|
|
590
115
|
|
|
591
116
|
【Swift】
|
|
592
|
-
```
|
|
117
|
+
``` java
|
|
118
|
+
import AtomicXCore
|
|
119
|
+
import ChatUIKit
|
|
593
120
|
import UIKit
|
|
594
|
-
import TUICore
|
|
595
|
-
import TIMCommon
|
|
596
|
-
import TUIChat
|
|
597
|
-
|
|
598
|
-
let conversationData = TUIChatConversationModel()
|
|
599
|
-
conversationData.userID = userID ?? ""
|
|
600
|
-
conversationData.groupID = groupID ?? ""
|
|
601
|
-
if let chatVC = getChatViewController(conversationData) {
|
|
602
|
-
navigationController?.pushViewController(chatVC, animated: true)
|
|
603
|
-
}
|
|
604
121
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
chat?.conversationData = model
|
|
613
|
-
return chat
|
|
122
|
+
func showConversationList() {
|
|
123
|
+
let conversationsPage = ConversationsPage(onConversationClick: { [weak self] info in
|
|
124
|
+
// 点击会话列表中的某条会话后,进入对应的聊天页
|
|
125
|
+
// self?.showChat(info.conversation)
|
|
126
|
+
})
|
|
127
|
+
navigationController.pushViewController(conversationsPage, animated: true)
|
|
614
128
|
}
|
|
615
129
|
```
|
|
616
130
|
|
|
617
|
-
|
|
618
|
-
``` objectivec
|
|
619
|
-
#import "TUIC2CChatViewController.h"
|
|
620
|
-
|
|
621
|
-
// ChatViewController 为您自己的 ViewController
|
|
622
|
-
@implementation ChatViewController
|
|
623
|
-
- (void)viewDidLoad {
|
|
624
|
-
// 创建会话信息
|
|
625
|
-
TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];
|
|
626
|
-
data.userID = @"userID";
|
|
627
|
-
// TUIC2CChatViewController
|
|
628
|
-
TUIC2CChatViewController *vc = [[TUIC2CChatViewController alloc] init];
|
|
629
|
-
[vc setConversationData:data];
|
|
630
|
-
// 把 TUIC2CChatViewController 添加到自己的 ViewController
|
|
631
|
-
[self addChildViewController:vc];
|
|
632
|
-
[self.view addSubview:vc.view];
|
|
633
|
-
}
|
|
634
|
-
@end
|
|
635
|
-
```
|
|
131
|
+
`ConversationsPage` 会自动从本地数据库加载最近会话。当用户点击某条会话时,`ConversationsPage` 会通过 `onConversationClick` 回调,把所选会话的信息传递给上层,您可以在该回调中创建并进入聊天页(见 步骤 4)。
|
|
636
132
|
|
|
637
|
-
|
|
638
|
-
> `TUIC2CChatViewController` 会自动拉取该用户的历史消息并展示出来。
|
|
639
|
-
>
|
|
133
|
+
### 步骤4:构建聊天界面
|
|
640
134
|
|
|
641
|
-
|
|
135
|
+
聊天页由 ChatPage 承载,负责消息的展示与收发。构造 ChatPage 时必须传入一个 `ConversationInfo`,用于指定要进入的会话。其中 `conversationID` 与 `type` 是必填的关键字段,title 用于聊天页导航栏标题的初始展示。
|
|
642
136
|
|
|
643
137
|
【Swift】
|
|
644
138
|
``` swift
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
if let chatVC = getChatViewController(conversationData) {
|
|
649
|
-
navigationController?.pushViewController(chatVC, animated: true)
|
|
650
|
-
}
|
|
139
|
+
import AtomicXCore
|
|
140
|
+
import ChatUIKit
|
|
141
|
+
import UIKit
|
|
651
142
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
143
|
+
// 进入单聊
|
|
144
|
+
let userID = "test_user"
|
|
145
|
+
var conversation = ConversationInfo(conversationID: ChatUtil.getC2CConversationID(userID))
|
|
146
|
+
conversation.type = .c2c
|
|
147
|
+
conversation.title = "与 \(userID) 聊天"
|
|
148
|
+
showChat(conversation)
|
|
149
|
+
|
|
150
|
+
// 进入群聊
|
|
151
|
+
let groupID = "@TGS#xxxxxx"
|
|
152
|
+
var groupConversation = ConversationInfo(conversationID: ChatUtil.getGroupConversationID(groupID))
|
|
153
|
+
groupConversation.type = .group
|
|
154
|
+
groupConversation.title = "测试群"
|
|
155
|
+
showChat(groupConversation)
|
|
156
|
+
|
|
157
|
+
func showChat(_ info: ConversationInfo) {
|
|
158
|
+
let chatPage = ChatPage(conversation: info) { [weak self] in
|
|
159
|
+
self?.navigationController.popViewController(animated: true)
|
|
658
160
|
}
|
|
659
|
-
|
|
660
|
-
return chat
|
|
161
|
+
navigationController.pushViewController(chatPage, animated: true)
|
|
661
162
|
}
|
|
662
163
|
```
|
|
663
164
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
#import "TUIC2CChatViewController_Minimalist.h"
|
|
667
|
-
|
|
668
|
-
// ChatViewController 为您自己的 ViewController
|
|
669
|
-
@implementation ChatViewController
|
|
670
|
-
- (void)viewDidLoad {
|
|
671
|
-
// 创建会话信息
|
|
672
|
-
TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];
|
|
673
|
-
data.userID = @"userID";
|
|
674
|
-
// 创建 TUIC2CChatViewController_Minimalist
|
|
675
|
-
TUIC2CChatViewController_Minimalist *vc = [[TUIC2CChatViewController_Minimalist alloc] init];
|
|
676
|
-
[vc setConversationData:data];
|
|
677
|
-
// 把 TUIC2CChatViewController 添加到自己的 ViewController
|
|
678
|
-
[self addChildViewController:vc];
|
|
679
|
-
[self.view addSubview:vc.view];
|
|
680
|
-
}
|
|
681
|
-
@end
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
> **说明**
|
|
685
|
-
>
|
|
686
|
-
> `TUIC2CChatViewController_Minimalist` 会自动拉取该用户的历史消息并展示出来。
|
|
165
|
+
> **注意:**
|
|
166
|
+
> 在聊天界面使用 相册/录像/视频通话等需要声明对应的权限,请在 App 的 Info.plist 中声明如下权限:
|
|
687
167
|
>
|
|
688
168
|
|
|
689
|
-
|
|
169
|
+
> `<key>NSCameraUsageDescription</key>`
|
|
170
|
+
> `<string>需要访问您的相机权限,开启后才能发送图片或视频</string>`
|
|
171
|
+
> `<key>NSMicrophoneUsageDescription</key>`
|
|
172
|
+
> `<string>需要访问您的麦克风权限,开启后才能发送语音</string>`
|
|
173
|
+
> `<key>NSPhotoLibraryAddUsageDescription</key>`
|
|
174
|
+
> `<string>需要访问您的相册权限,开启后保存图片或视频</string>`
|
|
175
|
+
> `<key>NSPhotoLibraryUsageDescription</key>`
|
|
176
|
+
> `<string>需要访问您的相册权限,开启后才能发送图片或视频</string>`
|
|
690
177
|
|
|
691
|
-
|
|
178
|
+
### 步骤5:构建联系人界面
|
|
692
179
|
|
|
693
|
-
|
|
180
|
+
联系人页由 ContactsPage 承载,展示当前用户的好友列表(按字母索引分组)与群列表入口 等。页面自带导航栏,右上角的 **+** 按钮内置了**添加好友**和**加入群聊**两个功能入口。
|
|
694
181
|
|
|
695
182
|
【Swift】
|
|
696
183
|
``` swift
|
|
184
|
+
import AtomicXCore
|
|
185
|
+
import ChatUIKit
|
|
697
186
|
import UIKit
|
|
698
|
-
import TUICore
|
|
699
|
-
import TIMCommon
|
|
700
|
-
import TUIContact
|
|
701
|
-
// ContactController 为您自己的 ViewController
|
|
702
|
-
public class ContactsController: UIViewController, TUIPopViewDelegate {
|
|
703
|
-
var contactVC: TUIContactController?
|
|
704
|
-
override public func viewDidLoad() {
|
|
705
|
-
super.viewDidLoad()
|
|
706
|
-
|
|
707
|
-
contactVC = TUIContactController()
|
|
708
|
-
if let contactVC = contactVC {
|
|
709
|
-
addChild(contactVC)
|
|
710
|
-
view.addSubview(contactVC.view)
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
```
|
|
715
187
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
//
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
188
|
+
func showContacts() {
|
|
189
|
+
let contactsPage = ContactsPage(
|
|
190
|
+
onContactClick: { [weak self] item in
|
|
191
|
+
// 点击好友列表中的某个联系人回调,可在该回调中进入单聊
|
|
192
|
+
// self?.showChat(with: item.userID, title: item.title)
|
|
193
|
+
},
|
|
194
|
+
onGroupClick: { [weak self] item in
|
|
195
|
+
// 点击群列表中的某个群的回调,可在该回调中进入群聊
|
|
196
|
+
// self?.showGroupChat(with: item.userID, title: item.title)
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
navigationController.pushViewController(contactsPage, animated: true)
|
|
728
200
|
}
|
|
729
|
-
@end
|
|
730
201
|
```
|
|
731
202
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
【Swift】
|
|
735
|
-
``` swift
|
|
736
|
-
import TUIContact
|
|
737
|
-
protocol TUIContactControllerListener: NSObjectProtocol {
|
|
738
|
-
func onSelectFriend(_ cell: TUICommonContactCell) -> Bool
|
|
739
|
-
func onAddNewFriend(_ cell: TUICommonTableViewCell) -> Bool
|
|
740
|
-
func onGroupConversation(_ cell: TUICommonTableViewCell) -> Bool
|
|
741
|
-
}
|
|
203
|
+
### 步骤 6:音视频通话
|
|
742
204
|
|
|
743
|
-
|
|
205
|
+
音视频通话能力由 TUICallKit_Swift 组件提供(Podfile 中需添加 pod 'TUICallKit_Swift')。
|
|
206
|
+
1. **开通音视频通话服务,请参考** [**开通音视频服务**](https://cloud.tencent.com/document/product/269/104815)**。**
|
|
744
207
|
|
|
745
|
-
|
|
746
|
-
``` objectivec
|
|
747
|
-
#import “TUIContactController.h”
|
|
748
|
-
@protocol TUIContactControllerListener <NSObject>
|
|
749
|
-
@optional
|
|
750
|
-
- (void)onSelectFriend:(TUICommonContactCell *)cell;
|
|
751
|
-
- (void)onAddNewFriend:(TUICommonTableViewCell *)cell;
|
|
752
|
-
- (void)onGroupConversation:(TUICommonTableViewCell *)cell;
|
|
753
|
-
@end
|
|
754
|
-
```
|
|
208
|
+
2. **登录成功后初始化通话引擎。**
|
|
755
209
|
|
|
756
|
-
|
|
210
|
+
`LoginStore` 登录只建立了消息通道,在登录成功后,通话引擎需单独初始化:
|
|
757
211
|
|
|
758
212
|
【Swift】
|
|
759
213
|
``` swift
|
|
760
|
-
// ContactController 为您自己的 ViewController
|
|
761
|
-
public class ContactsController: UIViewController, TUIPopViewDelegate {
|
|
762
|
-
override public func viewDidLoad() {
|
|
763
|
-
super.viewDidLoad()
|
|
764
|
-
|
|
765
|
-
contactVC = TUIContactController_Minimalist()
|
|
766
|
-
if let contactVC = contactVC {
|
|
767
|
-
addChild(contactVC)
|
|
768
|
-
view.addSubview(contactVC.view)
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
```
|
|
773
214
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
#import "TUIContactController_Minimalist.h"
|
|
777
|
-
|
|
778
|
-
// ContactController 为您自己的 ViewController
|
|
779
|
-
@implementation ContactController
|
|
780
|
-
- (void)viewDidLoad {
|
|
781
|
-
// 创建 TUIContactController_Minimalist
|
|
782
|
-
TUIContactController_Minimalist *vc = [[TUIContactController_Minimalist alloc] init];
|
|
783
|
-
// 把 TUIContactController_Minimalist 添加到自己的 ViewController
|
|
784
|
-
[self addChildViewController:vc];
|
|
785
|
-
[self.view addSubview:vc.view];
|
|
786
|
-
}
|
|
787
|
-
@end
|
|
788
|
-
```
|
|
215
|
+
import RTCRoomEngine
|
|
216
|
+
import TUICallKit_Swift
|
|
789
217
|
|
|
790
|
-
|
|
218
|
+
func initCallEngine() {
|
|
219
|
+
let youSdkAppID: Int32 = 10_000_000_00 // 填写你的实际sdkAppID
|
|
220
|
+
let testUserID = "testUserID" // 你的测试用户ID
|
|
221
|
+
let userSig = "xxxxxxx" // 你的测试用户ID对应的 userSig (从IM 控制台获取,看上面的截图)
|
|
791
222
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
223
|
+
TUICallEngine.createInstance().`init`(youSdkAppID, userId: testUserID, userSig: userSig) {
|
|
224
|
+
// enableIncomingBanner(true) 用于开启被叫时的来电横幅通知
|
|
225
|
+
TUICallKit.createInstance().enableIncomingBanner(enable: true)
|
|
226
|
+
} fail: { code, message in
|
|
227
|
+
print("initCallEngine failed: \(code), \(message ?? "")")
|
|
228
|
+
}
|
|
798
229
|
}
|
|
799
|
-
```
|
|
800
230
|
|
|
801
|
-
【Objective-C】
|
|
802
|
-
``` objectivec
|
|
803
|
-
@protocol TUIContactControllerListener_Minimalist <NSObject>
|
|
804
|
-
@optional
|
|
805
|
-
- (void)onSelectFriend:(TUICommonContactCell *)cell;
|
|
806
|
-
- (void)onAddNewFriend:(TUICommonTableViewCell *)cell;
|
|
807
|
-
- (void)onGroupConversation:(TUICommonTableViewCell *)cell;
|
|
808
|
-
@end
|
|
809
231
|
```
|
|
810
232
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
【经典版】
|
|
233
|
+
3. **发起通话。**
|
|
814
234
|
|
|
815
235
|
【Swift】
|
|
816
236
|
``` swift
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
let data = cell.contactData
|
|
825
|
-
let vc = TUIFriendProfileController(style: .grouped)
|
|
826
|
-
vc.friendProfile = data?.friendProfile
|
|
827
|
-
navigationController?.pushViewController(vc, animated: true)
|
|
237
|
+
func startVideoCall() {
|
|
238
|
+
TUICallKit.createInstance().calls(
|
|
239
|
+
userIdList: ["liu100"], // 被叫用户 ID 列表。单人通话传一个元素;传多个则为群组通话
|
|
240
|
+
mediaType: .video, // 通话类型:.video 视频通话、.audio 语音通话
|
|
241
|
+
params: nil,
|
|
242
|
+
completion: nil
|
|
243
|
+
)
|
|
828
244
|
}
|
|
829
245
|
```
|
|
830
246
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
- (void)onSelectFriend:(TUICommonContactCell *)cell
|
|
836
|
-
{
|
|
837
|
-
TUICommonContactCellData *data = cell.contactData;
|
|
838
|
-
// 创建好友资料 vc
|
|
839
|
-
TUIFriendProfileController *vc = [[TUIFriendProfileController alloc] init];
|
|
840
|
-
vc.friendProfile = data.friendProfile;
|
|
841
|
-
// 展示好友资料 vc
|
|
842
|
-
[self.navigationController pushViewController:(UIViewController *)vc animated:YES];
|
|
843
|
-
}
|
|
844
|
-
```
|
|
247
|
+
调用后 TUICallKit 会自动弹出全屏通话界面(含呼叫等待、接通、挂断全流程 UI),无需自行实现。
|
|
248
|
+
|
|
249
|
+
4. **如何移除音视频通话功能?**
|
|
845
250
|
|
|
846
|
-
|
|
251
|
+
ChatPage 默认集成了音视频通话功能,如果你不需要音视频通话功能。可以在 步骤 3 创建聊天界面 中关闭音视频通话开关,代码如下所示:
|
|
847
252
|
|
|
848
253
|
【Swift】
|
|
849
254
|
``` swift
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
let vc = TUIFriendProfileController_Minimalist()
|
|
856
|
-
vc.friendProfile = data?.friendProfile
|
|
857
|
-
navigationController?.pushViewController(vc, animated: true)
|
|
858
|
-
}
|
|
859
|
-
```
|
|
860
|
-
|
|
861
|
-
【Objective-C】
|
|
862
|
-
``` objectivec
|
|
863
|
-
#import "TUIFriendProfileController_Minimalist.h"
|
|
864
|
-
|
|
865
|
-
- (void)onSelectFriend:(TUICommonContactCell *)cell
|
|
866
|
-
{
|
|
867
|
-
TUICommonContactCellData *data = cell.contactData;
|
|
868
|
-
// 创建好友资料 vc
|
|
869
|
-
TUIFriendProfileController_Minimalist *vc = [[TUIFriendProfileController_Minimalist alloc] init];
|
|
870
|
-
vc.friendProfile = data.friendProfile;
|
|
871
|
-
// 展示好友资料 vc
|
|
872
|
-
[self.navigationController pushViewController:(UIViewController *)vc animated:YES];
|
|
873
|
-
}
|
|
874
|
-
```
|
|
875
|
-
|
|
876
|
-
### 步骤6:接入智能客服 Desk 用户端(可选)
|
|
877
|
-
|
|
878
|
-
若需同时集成智能客服 Desk 用户端,请先 [开通智能客服 Desk 服务](https://cloud.tencent.com/document/product/269/96059),并根据 [iOS 接入智能客服用户端](https://cloud.tencent.com/document/product/269/110808) 文档完成 `TencentCloudAIDeskCustomer` 包引入和配置,即可在您的应用中引入客服会话能力。
|
|
879
|
-
``` objectivec
|
|
880
|
-
#import <TencentCloudAIDeskCustomer/TencentCloudCustomerManager.h>
|
|
881
|
-
|
|
882
|
-
int SDKAppID = 0; // 开通了智能客服 Desk 的应用 ID
|
|
883
|
-
NSString *userID = @"";
|
|
884
|
-
NSString *userSig = @"";
|
|
885
|
-
|
|
886
|
-
// 上述三个参数, 可以和您登录腾讯云 IM 的保持一致, 也可以使用不同的应用和用户
|
|
887
|
-
|
|
888
|
-
// 用户昵称。设置后,用户端转人工成功时,人工客服在工作台可见。您可将用户手机号,用户来源等信息写入昵称,长度限制500字节
|
|
889
|
-
// 注意!设置后,即时通信 IM 同 userID 的昵称也会被更新
|
|
890
|
-
// 如您不希望变更,请设置为 @"" 或 nil
|
|
891
|
-
NSString *nickName = @"";
|
|
892
|
-
|
|
893
|
-
// 用户头像。设置后,用户端转人工成功时,人工客服在工作台可见
|
|
894
|
-
// 注意!设置后,即时通信 IM 同 userID 的头像也会被更新
|
|
895
|
-
// 如您不希望变更,请设置为 @"" 或 nil
|
|
896
|
-
NSString *avatar = @"";
|
|
897
|
-
|
|
898
|
-
[[TencentCloudCustomerManager sharedManager]
|
|
899
|
-
initWithProfile:SDKAppID
|
|
900
|
-
userID:userID
|
|
901
|
-
userSig:userSig
|
|
902
|
-
nickName:nickName
|
|
903
|
-
avatar:avatar
|
|
904
|
-
completion:^(NSError *error) {
|
|
905
|
-
if (error) {
|
|
906
|
-
NSLog(@"login failed. error:%@", error);
|
|
255
|
+
func showChat(_ info: ConversationInfo) {
|
|
256
|
+
// 在输入配置中关闭输入面板中的视频通话和音频通话功能
|
|
257
|
+
let inputConfig = ChatMessageInputConfig(isShowVideoCall: false, isShowAudioCall: false)
|
|
258
|
+
let chatPage = ChatPage(conversation: info, messageInputConfig: inputConfig) { [weak self] in
|
|
259
|
+
self?.navigationController.popViewController(animated: true)
|
|
907
260
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
// 点击打开智能客服会话页面
|
|
911
|
-
[[TencentCloudCustomerManager sharedManager] pushCustomerServiceChatFromController:self];
|
|
261
|
+
navigationController.pushViewController(chatPage, animated: true)
|
|
262
|
+
}
|
|
912
263
|
```
|
|
913
264
|
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
TUI 组件支持在聊天界面对用户发起音视频通话,仅需要简单几步就可以快速集成:
|
|
917
|
-
|
|
918
|
-
1. 开通音视频服务。
|
|
919
|
-
|
|
920
|
-
2. 登录 即时通信 IM 控制台 ,单击目标应用卡片,进入应用的基础配置页面。
|
|
921
|
-
|
|
922
|
-
3. 在开通腾讯实时音视频服务功能区,单击**免费体验**即可开通 TUICallKit 的 7 天免费试用服务。
|
|
923
|
-
|
|
924
|
-
4. 在弹出的开通实时音视频 TRTC 服务对话框中,单击确认,系统将为您在 [实时音视频控制台](https://console.cloud.tencent.com/trtc) 创建一个与当前 IM 应用相同 SDKAppID 的实时音视频应用,二者账号与鉴权可复用。
|
|
925
|
-
|
|
926
|
-
5. 集成 TUICallKit 组件。
|
|
927
|
-
在 podfile 文件中添加以下内容。
|
|
928
|
-
|
|
929
|
-
``` objectivec
|
|
930
|
-
// 集成音视频通话组件
|
|
931
|
-
pod 'TUICallKit_Swift'
|
|
932
|
-
```
|
|
933
|
-
6. 使用音视频功能,需要授权摄像头和麦克风的使用权限,请根据实际项目需要,设置项目所需权限。
|
|
934
|
-
|
|
935
|
-
在 **Xcode** 中,选择 **TARGETS > Info > Custom iOS Target Properties** 菜单。
|
|
936
|
-
|
|
937
|
-
单击 **+**,添加摄像头和麦克风权限:
|
|
265
|
+
## AI 助手:知识咨询与代码集成
|
|
938
266
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
- Privacy - Microphone Usage Description
|
|
942
|
-
|
|
943
|
-
7. 发起和接收视频或语音通话。
|
|
944
|
-
|
|
945
|
-
集成 TUICallKit 组件后,聊天界面和联系人资料界面默认会出现 “视频通话” 和 “语音通话” 两个按钮,当用户点击按钮时,TUIKit 会自动展示通话邀请 UI,并给对方发起通话邀请请求。
|
|
946
|
-
|
|
947
|
-
- 当用户在线收到通话邀请时,TUIKit 会自动展示通话接收 UI,用户可以选择同意或者拒绝通话。
|
|
948
|
-
|
|
949
|
-
- 当用户离线收到通话邀请时,如果需要唤起 App 通话,就要使用到离线推送能力,离线推送的实现请参见 [添加离线推送](https://cloud.tencent.com/document/product/269/109894)。
|
|
950
|
-
|
|
951
|
-
8. 添加离线推送。
|
|
952
|
-
在使用离线推送之前,您需要开通 [IM 离线推送](https://cloud.tencent.com/document/product/269/75429) 服务。
|
|
953
|
-
|
|
954
|
-
9. 关于 App 的配置,您可以参见文档:[集成推送服务(Push)跑通离线推送功能](https://cloud.tencent.com/document/product/269/109894)。
|
|
955
|
-
|
|
956
|
-
> **说明:**
|
|
957
|
-
>
|
|
958
|
-
> 配置完成后,当单击接收到的**音视频通话离线推送通知**时, TUICallKit 会自动拉起**音视频通话邀请界面**。
|
|
959
|
-
>
|
|
960
|
-
|
|
961
|
-
10. 附加增值能力
|
|
962
|
-
|
|
963
|
-
集成 TUIChat 和 TUICallKit 的组件后,在聊天界面发送语音消息时,即可**录制带 AI 降噪和自动增益的语音消息**。该功能需要购买 [音视频通话能力](https://cloud.tencent.com/document/product/1640/79968) 进阶版及以上套餐,仅 IMSDK 7.0 及以上版本支持。当套餐过期后,录制语音消息会切换到系统 API 进行录音。
|
|
964
|
-
|
|
965
|
-
下面是使用两台华为 P10 同时录制的语音消息对比:
|
|
966
|
-
|
|
967
|
-
<link rel="stylesheet" href="//cloudcache.tencentcs.com/open_proj/proj_qcloud_v2/gateway/portal/css/global-20209142343.css?max_age=31536000&t=20191128" />
|
|
968
|
-
<link rel="stylesheet" href="//cloudcache.tencentcs.com/open_proj/proj_qcloud_v2/gateway/portal/css/global-components.css?max_age=31536000&t=20180817" />
|
|
969
|
-
<link rel="stylesheet" href="//cloudcache.tencentcs.com/open_proj/proj_qcloud_v2/gateway/documentation/documentation-v4/css/pandect-20219091610.css" />
|
|
970
|
-
<link rel="stylesheet" href="//cloudcache.tencentcs.com/open_proj/proj_qcloud_v2/gateway/documentation/documentation-v4/css/import-2-markdown-20219091610.css" />
|
|
971
|
-
<link rel="stylesheet" href="//cloudcache.tencentcs.com/open_proj/proj_qcloud_v2/platform/documents/css/documents-202205161915.css" />
|
|
972
|
-
<link rel="stylesheet" href="//cloudcache.tencentcs.com/open_proj/proj_qcloud_v2/gateway/documentation/documentation-v4/css/pandect-202012171130.css" />
|
|
973
|
-
<link rel="stylesheet" href="//qcloudimg.tencent-cloud.cn/static/document/qcloud-document-sdk.v0.0.17.css" />
|
|
974
|
-
<link rel="stylesheet" href="//cloudcache.tencentcs.com/qcloud/main/components/document-feedback/document-feedback.944df9c907.css" />
|
|
975
|
-
<style>
|
|
976
|
-
* {
|
|
977
|
-
font-family: 'pingfang SC','helvetica neue',arial,'hiragino sans gb','microsoft yahei ui','microsoft yahei',simsun,sans-serif;
|
|
978
|
-
}
|
|
979
|
-
</style>
|
|
980
|
-
|
|
981
|
-
<div class="markdown-text-box">
|
|
982
|
-
| <b>系统录制的语音消息<br></b> | <b>TUICallkit 录制的带 AI 降噪和自动增益的语音消息<br></b> |
|
|
983
|
-
| --- | --- |
|
|
984
|
-
| <audio id="audio" controls preload="none">
|
|
985
|
-
<source id="m4a" src="https://im.sdk.cloudcachetci.com/tools/resource/rain_system_record.m4a"></source>
|
|
986
|
-
</audio> | <audio id="audio" controls preload="none">
|
|
987
|
-
<source id="m4a" src="https://im.sdk.cloudcachetci.com/tools/resource/rain_tuicallkit_record_with_agc_aidenoise.m4a"></source>
|
|
988
|
-
</audio> |
|
|
989
|
-
|
|
990
|
-
</div>
|
|
991
|
-
|
|
992
|
-
### 步骤8:构建多人音视频功能
|
|
993
|
-
|
|
994
|
-
TUI 组件支持在聊天界面对用户发起多人音视频,仅需要简单几步就可以快速集成:
|
|
995
|
-
|
|
996
|
-
1. 开通音视频服务。
|
|
997
|
-
|
|
998
|
-
2. 登录 [即时通信 IM 控制台](https://console.cloud.tencent.com/im),单击目标应用卡片,进入应用的基础配置页面。
|
|
999
|
-
|
|
1000
|
-
3. 找到含 UI 低代码场景方案功能区,单击卡片下方的多人音视频(TUIRoomKit) > 免费体验。
|
|
1001
|
-
|
|
1002
|
-
4. 在弹窗中单击免费试用 7 天,即可成功开通多人音视频免费体验版。开通完成后即可参见 [集成指引](https://cloud.tencent.com/document/product/269/84296) 进行集成。
|
|
1003
|
-
|
|
1004
|
-
5. 集成 TUIRoomKit 组件。在 podfile 文件中添加以下内容。
|
|
1005
|
-
|
|
1006
|
-
``` ruby
|
|
1007
|
-
// 集成多人音视频组件
|
|
1008
|
-
pod 'TUIRoomKit'
|
|
1009
|
-
```
|
|
1010
|
-
6. 发起多人音视频会议
|
|
1011
|
-
|
|
1012
|
-
集成 TUIRoomKit 组件后,聊天界面默认会出现 “快速会议” 按钮,当用户点击按钮时,TUIKit 会自动发起会议,并在聊天记录中展示一条会议邀请卡片。
|
|
267
|
+
在接入 IM SDK 过程中,您可以通过 MCP 使用 AI 助手,快速完成知识咨询、报错排查和 UIKit 集成代码生成。支持 Web/Android/iOS/Flutter/uni-app 等平台,答案基于官方文档。适用于查询 SDK API、UI 组件用法、服务端 API 与 IM 产品配置等场景,[立即体验,提出您的第一个问题](https://cloud.tencent.com/document/product/269/126983)。
|
|
1013
268
|
|
|
1014
269
|
## 常见问题
|
|
1015
270
|
|
|
1016
|
-
|
|
271
|
+
### 音视频常见问题
|
|
1017
272
|
|
|
1018
|
-
|
|
273
|
+
#### TUICallKit 和自己集成的音视频库冲突了?
|
|
1019
274
|
|
|
1020
275
|
腾讯云的音视频库不能同时集成,可能存在符号冲突,可以按照下面的场景处理。
|
|
1021
276
|
1. 如果您使用了 `TXLiteAVSDK_TRTC` 库,不会发生符号冲突。可直接在 Podfile 文件中添加依赖,
|
|
@@ -1030,18 +285,34 @@ TUI 组件支持在聊天界面对用户发起多人音视频,仅需要简单
|
|
|
1030
285
|
```
|
|
1031
286
|
3. 如果您使用了 `TXLiteAVSDK_Enterprise` 库,会产生符号冲突。建议升级到 `TXLiteAVSDK_Professional` 后使用 TUICallKit_Swift/Professional。
|
|
1032
287
|
|
|
1033
|
-
|
|
288
|
+
#### 通话邀请的超时时间默认是多久?
|
|
1034
289
|
|
|
1035
290
|
通话邀请的默认超时时间是 30 秒。
|
|
1036
291
|
|
|
1037
|
-
|
|
292
|
+
#### 在邀请超时时间内,被邀请者如果离线再上线,能否立即收到邀请?
|
|
1038
293
|
- 如果是单聊通话邀请,被邀请者离线再上线可以收到通话邀请,TUIKit 内部会自动唤起通话邀请界面。
|
|
1039
294
|
|
|
1040
295
|
- 如果是群聊通话邀请,被邀请者离线再上线后会自动拉取最近 30 秒内的邀请,TUIKit 会自动唤起群通话界面。
|
|
1041
296
|
|
|
1042
|
-
####
|
|
297
|
+
#### 如何移除音视频通话功能?
|
|
1043
298
|
|
|
1044
|
-
|
|
299
|
+
ChatPage 默认集成了音视频通话功能,如果你不需要音视频通话功能。可以在 步骤 3 创建聊天界面 中关闭音视频通话开关,代码如下所示:
|
|
300
|
+
|
|
301
|
+
【Swift】
|
|
302
|
+
``` swift
|
|
303
|
+
func showChat(_ info: ConversationInfo) {
|
|
304
|
+
// 在输入配置中关闭输入面板中的视频通话和音频通话功能
|
|
305
|
+
let inputConfig = ChatMessageInputConfig(isShowVideoCall: false, isShowAudioCall: false)
|
|
306
|
+
let chatPage = ChatPage(conversation: info, messageInputConfig: inputConfig) { [weak self] in
|
|
307
|
+
self?.navigationController.popViewController(animated: true)
|
|
308
|
+
}
|
|
309
|
+
navigationController.pushViewController(chatPage, animated: true)
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### 上架常见问题
|
|
314
|
+
|
|
315
|
+
#### 上架 App Store 时打包失败,提示 Unsupported Architectures?
|
|
1045
316
|
|
|
1046
317
|
您可以按照下面的步骤,在打包时去掉模拟器版本:
|
|
1047
318
|
1. 选中您工程的 Target,并点击 Build Phases 选项,在当前面板中添加 Run Script;
|
|
@@ -1087,7 +358,7 @@ TUI 组件支持在聊天界面对用户发起多人音视频,仅需要简单
|
|
|
1087
358
|
|
|
1088
359
|
### Xcode 集成常见问题
|
|
1089
360
|
|
|
1090
|
-
####
|
|
361
|
+
#### [Xcodeproj] Unknown object version (60). (RuntimeError)
|
|
1091
362
|
|
|
1092
363
|
使用 Xcode 15 创建新工程来集成 TUIKit 时,输入 **pod install** 后,可能会遇到此问题,原因是使用了较旧版本的 CocoaPods ,此时有两种解决办法:
|
|
1093
364
|
|
|
@@ -1097,7 +368,7 @@ TUI 组件支持在聊天界面对用户发起多人音视频,仅需要简单
|
|
|
1097
368
|
|
|
1098
369
|
您可以在终端输入 **pod --version** 查看当前的 Pods 版本。
|
|
1099
370
|
|
|
1100
|
-
####
|
|
371
|
+
#### -ld64链接器问题?
|
|
1101
372
|
|
|
1102
373
|
Assertion failed: (false && "compact unwind compressed function offset doesn't fit in 24 bits"), function operator(), file Layout.cpp,
|
|
1103
374
|
|
|
@@ -1107,17 +378,17 @@ Assertion failed: (false && "compact unwind compressed function offset doesn't f
|
|
|
1107
378
|
|
|
1108
379
|
在 **Build Settings** 中的 **Other Linker Flags** 中添加"**-ld64**",即可解决。 参考资料: [https://developer.apple.com/forums/thread/735426](https://links.jianshu.com/go)。
|
|
1109
380
|
|
|
1110
|
-
####
|
|
381
|
+
#### Rosetta 模拟器问题?
|
|
1111
382
|
|
|
1112
383
|
使用苹果芯片(M1\M2等系列芯片)时会遇到, 原因是包括 SDWebImage 在内的三方库,并未支持 xcframework,不过苹果依旧给出了适配办法,就是在模拟器上开启 Rosetta 设置, 一般情况下编译时会自动弹出 Rosetta 选项。
|
|
1113
384
|
|
|
1114
|
-
####
|
|
385
|
+
#### Xcode 15 开发者沙盒选项问题?
|
|
1115
386
|
|
|
1116
387
|
Sandbox: bash(xxx) deny(1) file-write-create
|
|
1117
388
|
|
|
1118
389
|
当您使用 Xcode 15 创建一个新工程时, 可能会因为此选项导致编译运行失败,建议您关闭此选项。
|
|
1119
390
|
|
|
1120
|
-
####
|
|
391
|
+
#### Xcode 16 不支持 Framework 开启 bitcode 问题?
|
|
1121
392
|
|
|
1122
393
|
**解决方案1:升级 SDK**
|
|
1123
394
|
|
|
@@ -1146,23 +417,13 @@ end
|
|
|
1146
417
|
|
|
1147
418
|
### CocoaPods 集成常见问题
|
|
1148
419
|
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
若您使用远端 Pods 集成时,出现 **Podfile.lock** 和 插件依赖的 TUICore 版本不一致时,
|
|
420
|
+
若您执行 pod install,出现 **Podfile.lock** 和 插件依赖的版本不一致时,
|
|
1152
421
|
|
|
1153
422
|
此时请删除 **Podfile.lock** 文件, 并使用 **pod repo update** 更新本地代码仓库, 之后使用 **pod update** 重新更新即可。
|
|
1154
423
|
|
|
1155
|
-
#### 2. 使用本地集成时,Pod 依赖版本不匹配问题
|
|
1156
|
-
|
|
1157
|
-
若您使用 DevelopPods 集成时 出现 插件依赖的 **TUICore** 版本较新,但本地 Pod 依赖的版本号是 **1.0.0** ,
|
|
1158
|
-
|
|
1159
|
-
此时请您参见 [Podfile_local](https://github.com/TencentCloud/TIMSDK/blob/master/iOS/Demo/Podfile_local) 和 [TUICore.spec](https://github.com/TencentCloud/TIMSDK/blob/master/iOS/TUIKit/TUICore/TUICore.podspec) , 插件需要跟随版本,需要和 TUICore.spec 中一致,正常情况下我们会帮您修改为一致。
|
|
1160
|
-
|
|
1161
|
-
第一次使用本地集成时,建议您下载我们的示例 Demo 工程,将 Podfile 文件内容替换为 Podfile_local 的内容,执行 **Pod update** 后相互参照。
|
|
1162
|
-
|
|
1163
424
|
### 其他常见问题
|
|
1164
425
|
|
|
1165
|
-
|
|
426
|
+
#### 表情包的使用
|
|
1166
427
|
|
|
1167
428
|
为了尊重版权,IM Demo/TUIKit 工程中默认不包含大表情元素切图。正式上线商用前请您替换为自己设计或拥有版权的其他表情包。下图所示默认的**小黄脸表情包版权归腾讯云所有**,可有偿授权使用,如需获得授权,您可以通过升级至 [IM 企业版套餐](https://buy.cloud.tencent.com/avc) 免费使用该表情包。
|
|
1168
429
|
|