• UIKit
  • SDK
  • サーバー API
iOS and macOS/
  • Overview
  • Run Demo
  • 開始
  • インストール
    • TUIKit
    • TUIChat のみ
  • Build Basic Interfaces
    • Chat
    • Conversation List
    • Contact List
    • Add Contact
    • Create Group Chat
    • Video and Audio Call
  • Features
    • 反応
    • Quote
    • 既読レシート
    • ユーザーのオンライン状態
    • Translation
    • Voice to Text
    • メッセージ検索
  • カスタマイズ
    • メッセージのカスタマイズ
    • 絵文字とステッカーのカスタマイズ
  • ローカライズ
  • Changelog
  • Guideline for Beginners
  • コンソールガイド
    • アプリケーションの作成とアップグレード
    • 基本設定
    • 機能設定
    • アカウント管理
    • グループ管理
    • コールバック設定
  • 製品紹介
    • メッセージ管理
      • シングルチャットメッセージ
      • メッセージの保存
      • オフラインプッシュ
      • グループメッセージ
      • メッセージフォーマット
    • アカウントシステム
      • ログイン認証
      • オンライン状態管理
    • グループ関連
      • グループシステム
      • グループ管理
    • ユーザープロファイルとリレーションシップチェーン
      • 資料管理
      • リレーションシップチェーン管理
  • 購入ガイド
    • 課金の概要
    • 価格
  • エラーコード


Local search is implemented in the TUISearch component of TUIKit. It allows users to quickly find the expected information from massive amounts of complex data, such as the chat history, contacts, and group chats. It can also be used as an operations tool to easily and efficiently navigate to extensive content.
The local search feature is only available on the Chat Ultimate edition. To use it, purchase the Ultimate edition. For more information, see Pricing.

Feature Demonstration

The search API UI consists of three parts: the first part is for friend search, the second part is for group and group member search, and the third part is for message search, where messages are classified by conversation. Download and install the app to experience it now.

Integration Guide

The following introduces how to integrate the TUISearch component.

Purchasing the package

Integrating TUISearch

Add the following content to your Podfile:
// Integrate TUISearch
pod 'TUISearch'
Run pod instal.

Logging in to TUIKit

You need to call TUILogin of TUICore to log in to TUIKit. Initialization is implemented inside the login API by default, and no additional call to the initialization API is required.
[TUILogin login:SDKAPPID
// Login succeeded
} fail:^(int code, NSString *msg) {
// Login fails.

Starting the search UI

If you have integrated the TUIConversation and TUISearch components, no additional processing is required at this point and searchBar is displayed above the conversation list by default.

If you have integrated only TUISearch, you can directly initialize TUISearchBar and add it to your own view. The search UI logic and UI are encapsulated inside TUISearchBar. After adding TUISearchBar, you can click it to trigger a search.
Sample code:
// Initialize the component
TUISearchBar *searchBar = [[TUISearchBar alloc] init];
// self.containerView indicates your own view
[self.containerView addSubview:searchBar];


How do I search for custom messages?

You need to use the createCustomMessage:desc:extension API to create and send a custom message, and specify the text to search in the desc parameter.
If you use the createCustomMessage API to create a custom message, a binary data stream is saved locally, and the custom message cannot be searched.
If you configure the offline push feature and specify the desc parameter, the custom message will also be pushed offline, and the content specified in the desc parameter will be displayed in the notification bar. If you do not need the offline push feature, use the disablePush parameter in V2TIMOfflinePushInfo of the sendMessage API to disable it.
If you do not want the searched text to be displayed as the pushed content, use the desc parameter in V2TIMOfflinePushInfo to specify the pushed content.

How do I search for rich media messages?

Rich media messages include file, image, audio, and video messages.
For a file message, the filename is usually displayed on the UI. Therefore, you can set the fileName parameter as the searched content when creating a file message. If fileName is not set, the system gets the filename from filePath and saves it to both the local device and the server.
For an image, audio, or video message, the thumbnail or duration is usually displayed on the UI. In this case, you can specify the message type for search but cannot specify keywords for search.