git clone https://github.com/Tencent-RTC/TUIKit_iOS.git
chat and call folders from the repository root to your project root directory. The directory structure after copying is as follows:YourApplication/├── source/ # Your project code├── call/ # Audio/video call component│ └── TUICallKit_Swift.podspec│ └── TUICallKit_Swift/├── chat/ # Chat source code│ ├── demo/ # Demo project│ └── uikit/ # Chat UIKit component library├── Podfile # Dependency configuration file├── YourApplication.xcworkspace # Your project file
chat/ directory (chat/uikit is the UIKit component library, and chat/demo is the demo project), and its dependent audio/video call component call/TUICallKit_Swift is located in the repository root. Module directories can be placed anywhere in your project; just set the correct relative paths in the Podfile.# Replace your_project_name with your actual project nametarget 'your_project_name' do# Add the following two dependencies: TUIChatKit and TUICallKit_Swift# Note the relative pathspod 'TUIChatKit', :path => 'chat/uikit/TUIChatKit.podspec'pod 'TUICallKit_Swift', :path => 'call/TUICallKit_Swift.podspec'end
pod install# If you cannot install the latest version of TUIKit, run the following commands to update your local CocoaPods repository list.# pod repo update# pod update

login API of LoginStore and pass in the sdkAppID, userID, and userSig obtained above for login authentication:import AtomicXCoreimport TUIChatKitimport UIKitlet yourSdkAppID: Int32 = 10_000_000_00 // Replace with your actual sdkAppIDlet testUserID = "testUserID" // Your test userIDlet userSig = "xxxxxxx" // The userSig for your test userID (obtained from the Console; see the screenshot above)LoginStore.shared.login(sdkAppID: yourSdkAppID, userID: testUserID, userSig: userSig) { [weak self] result inDispatchQueue.main.async {switch result {case .success:// After login succeeds, show the conversation list// self?.showConversationList()case .failure(let error):print("login failed: \\(error.code) \\(error.message)")}}}
ConversationsPage object and push it to the navigation controller:import AtomicXCoreimport TUIChatKitimport UIKitfunc showConversationList() {let conversationsPage = ConversationsPage(onConversationClick: { [weak self] info in// After tapping a conversation in the list, navigate to the corresponding chat page// self?.showChat(info.conversation)})navigationController.pushViewController(conversationsPage, animated: true)}
ConversationsPage automatically loads recent conversations from the local database. When the user taps a conversation, ConversationsPage passes the selected conversation's information to the upper layer through the onConversationClick callback, where you can create and navigate to the chat page (see Step 4).ConversationInfo to specify the conversation to enter. conversationID and type are required key fields, and title is used for the initial display of the chat page navigation bar title.import AtomicXCoreimport TUIChatKitimport UIKit// One-to-one chatlet userID = "test_user"var conversation = ConversationInfo(conversationID: ChatUtil.getC2CConversationID(userID))conversation.type = .c2cconversation.title = "Chat with \\(userID)"showChat(conversation)// Group chatlet groupID = "@TGS#xxxxxx"var groupConversation = ConversationInfo(conversationID: ChatUtil.getGroupConversationID(groupID))groupConversation.type = .groupgroupConversation.title = "Test Group"showChat(groupConversation)func showChat(_ info: ConversationInfo) {let chatPage = ChatPage(conversation: info, onBack: { [weak self] inself?.navigationController.popViewController(animated: true)})navigationController.pushViewController(chatPage, animated: true)}
<key>NSCameraUsageDescription</key><string>Camera access is required to send photos or videos</string><key>NSMicrophoneUsageDescription</key><string>Microphone access is required to send voice messages</string><key>NSPhotoLibraryAddUsageDescription</key><string>Photo library access is required to save photos or videos</string><key>NSPhotoLibraryUsageDescription</key><string>Photo library access is required to send photos or videos</string>
import AtomicXCoreimport TUIChatKitimport UIKitfunc showContacts() {let contactsPage = ContactsPage(onContactClick: { [weak self] contact in// Callback when a contact in the friend list is tapped (ContactInfo); navigate to a one-to-one chat here// self?.showChat(with: contact.userID, title: contact.nickname ?? contact.userID)},onGroupClick: { [weak self] group in// Callback when a group in the group list is tapped (GroupInfo); navigate to a group chat here// self?.showGroupChat(with: group.groupID, title: group.groupName)})navigationController.pushViewController(contactsPage, animated: true)}
LoginStore login only establishes the messaging channel. After login succeeds, the call engine needs to be initialized separately:import RTCRoomEngineimport TUICallKit_Swiftfunc initCallEngine() {let youSdkAppID: Int32 = 10_000_000_00 // Replace with your actual sdkAppIDlet testUserID = "testUserID" // Your test userIDlet userSig = "xxxxxxx" // The userSig for your test userID (obtained from the Console; see the screenshot above)TUICallEngine.createInstance().`init`(youSdkAppID, userId: testUserID, userSig: userSig) {// enableIncomingBanner(true) enables the incoming call banner notification for the calleeTUICallKit.createInstance().enableIncomingBanner(enable: true)} fail: { code, message inprint("initCallEngine failed: \\(code), \\(message ?? "")")}}
func startVideoCall() {TUICallKit.createInstance().calls(userIdList: ["John"], // List of callee user IDs. Pass one element for a one-to-one call, or multiple for a group callmediaType: .video, // Call type: .video for video call, .audio for voice callparams: nil,completion: nil)}
func showChat(_ info: ConversationInfo) {// Disable video call and audio call features in the input panel via the input configurationlet inputConfig = ChatMessageInputConfig(isShowVideoCall: false, isShowAudioCall: false)let chatPage = ChatPage(conversation: info, messageInputConfig: inputConfig, onBack: { [weak self] inself?.navigationController.popViewController(animated: true)})navigationController.pushViewController(chatPage, animated: true)}
TXLiteAVSDK_TRTC library, no symbol conflict occurs. You can add the dependency directly to your Podfile:pod 'TUICallKit_Swift'
TXLiteAVSDK_Professional library, symbol conflicts will occur. Add the following dependency to your Podfile:pod 'TUICallKit_Swift/Professional'
TXLiteAVSDK_Enterprise library, symbol conflicts will occur. We recommend upgrading to TXLiteAVSDK_Professional and then using TUICallKit_Swift/Professional.

#!/bin/sh# Strip invalid architecturesstrip_invalid_archs() {binary="$1"echo "current binary ${binary}"# Get architectures for current filearchs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"stripped=""for arch in $archs; doif ! [[ "${ARCHS}" == *"$arch"* ]]; thenif [ -f "$binary" ]; then# Strip non-valid architectures in-placelipo -remove "$arch" -output "$binary" "$binary" || exit 1stripped="$stripped $arch"fifidoneif [[ "$stripped" ]]; thenecho "Stripped $binary of architectures:$stripped"fi}APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"# This script loops through the frameworks embedded in the application and# removes unused architectures.find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORKdoFRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"strip_invalid_archs "$FRAMEWORK_EXECUTABLE_PATH"done


pod install. It is caused by an outdated version of CocoaPods. There are two solutions:






post_install do |installer|bitcode_strip_path = 'xcrun --find bitcode_strip'.chop!def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)framework_path = File.join(Dir.pwd, framework_relative_path)command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"puts "Stripping bitcode: #{command}"system(command)endframework_paths = ["/Pods/TXIMSDK_iOS/ImSDK.framework/ImSDK",]framework_paths.each do |framework_relative_path|strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)endend
pod install and encounter a version mismatch between Podfile.lock and the plugin dependency versions:
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan