please select
  • UIKit
  • SDK
  • Server APIs
Chat/
SDK/
iOS and macOS/
Installation/
SDK
  • Installation
    • iOS
    • macOS
  • Initialize Chat SDK
  • Login and Logout
  • Message
    • Overview
    • Send a Message
    • Receive a Message
    • Retrieve Messages
    • Forward Messages
    • Modify a Message
    • Insert a Message
    • Delete Messages
    • Clear History Messages
    • Recall a Message
    • Send an Online Message
    • Message Read Receipt
    • Query Messages
    • Mentions
    • Targeted Group Messages
    • Do not Notify
    • Key-Value Extensions
    • Reactions
    • Translation
    • Pin Messages
  • Conversation
    • Overview
    • Conversation List
    • Get Conversations
    • Unread Count
    • Pin Conversations
    • Delete Conversations
    • Draft
    • Mark
    • Conversation Group
  • Group
    • Overview
    • Manage Group
    • Profile
    • Manage Members
    • Member Profile
    • Attribute
    • Counter
  • Community and Topic
    • Manage Community
    • Permission Group
  • User
    • User Profile
    • User Status
    • Manage Friends
    • Friend Group
    • Block Lists
    • Follow
  • Local Search
    • Search Messages
    • Search Friends
    • Search Groups
    • Search Group Members
  • Signaling
  • API Reference
    • Swift
    • Objective-C
  • Guideline for Beginners
  • Console Guide
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
  • Product Introduction
    • Message Management
      • One-to-One Message
      • Message Storage
      • Offline Push
      • Group Message
      • Message Formats
    • Account System
      • Login Authentication
      • Online Status Management
    • Group Related
      • Group System
      • Group Management
    • User Profile and Relationship Chain
      • Profile Management
      • Relationship Chain Management
  • Purchase Guide
    • Billing Overview
    • Pricing
  • Error Codes

iOS

This document describes how to quickly integrate the Chat SDK to your projects.

Environment Requirements

Xcode 9.0+.
iPhone or iPad on iOS 8.0 or above.
Your project has a valid developer signature.

Integrating SDK

You can either automatically integrate SDK using CocoaPods, or manually download the SDK and import it to your current project.

CocoaPods

1. Install CocoaPods

Enter the following command in the terminal window (you need to install the Ruby environment on your macOS in advance):
sudo gem install cocoapods

2. Create a Podfile

Go to the path where the project is located and run the following command. Then, a Podfile will appear under the project path.
pod init

3. Edit the Podfile

Add the dependency to your Podfile:
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'

target 'App' do
# Add the SDK
pod 'TXIMSDK_Plus_iOS'
# pod 'TXIMSDK_Plus_iOS_XCFramework'
# pod 'TXIMSDK_Plus_Swift_iOS_XCFramework'

# If you need to add the Quic plugin, please uncomment the next line.
# Note:
# - This plugin must be used with the TXIMSDK_Plus_iOS or TXIMSDK_Plus_iOS_XCFramework edition of the IM SDK, and the plugin version number must match the IM SDK version number. # - For the TXIMSDK_Plus_Swift_iOS_XCFramework edition, there is no need to add this plugin. If you need to use the Quic feature in this edition, please contact us.
# pod 'TXIMSDK_Plus_QuicPlugin'
end

4. Install the SDK or update the local repository.

Run the following command in the terminal window to update the local library file and install the Chat SDK:
pod install
Or, run the following command to update the local repository:
pod update
After the pod command is executed, an .xcworkspace project file integrated with the SDK will be generated. Double-click this file to open it. If the pod search fails, you are advised to update the local repo cache of the pod by running the following commands:
pod setup
pod repo update
rm ~/Library/Caches/CocoaPods/search_index.json
Note:
Quic plugin provides axp-quic multiplexing protocol, which has better weak network resistance and can still provide services even when the network packet loss rate reaches 70%. This plugin is only available on the Chat Premium edition, purchase the Premium edition to use it. To ensure proper functionality, please update the client SDK to version 7.7.5282 or higer.
If you need to use the Quic feature in the Swift edition of the SDK, please contact us through the Telegram technical group.

Manual integration

1. Download the SDK

Download the latest SDK version from Github.ImSDK_Plus.framework are the core dynamic library files of the SDK.

2. Create a project

Create a project.

Enter a project name, for example, IMDemo.


3. Integrate the SDK

Add the dependency library: select Target for IMDemo. On the General panel, add the dependency library under Embedded Binaries and Linked Frameworks and Libraries, select ImSDK_Plus.framework.

Set link parameters: add -ObjC in Build Setting -> Other Linker Flags.
Note:
For manual integration, you need to change ImSDK_Plus.framework to Embed&Sign in Target -> General -> Frameworks -> Libraries and Embedded Content.
If you need to add a Quic plugin, please refer to the previous steps and manually download the integrated Quic plugin.

Import SDK

There are two ways to use the SDK in your project code.

Method 1

Choose Xcode -> Build Setting -> Header Search Paths, and set the SDK header file path. In files that require the SDK API, reference the corresponding header file.
#import "ImSDK_Plus.h"

Method 2

In files that require the SDK API, reference the corresponding header file.
#import <ImSDK_Plus/ImSDK_Plus.h>

FAQs

[Xcodeproj] Unknown Object Version (60). (RuntimeError)

When you use Xcode 15 to create a project to integrate TUIKit, entering pod install may result in this issue. The reason is that an earlier version of CocoaPods is used. The following two solutions are available:
Solution 1: Change the Project Format version of the Xcode project.

Solution 2: Upgrade the local version of CocoaPods. The upgrading method is not covered in this document.
You can enter pod --version in the terminal to check the current version of Pods.
Xcode 15 Developer Sandbox Option Issue
Sandbox: bash(xxx) deny(1) file-write-create

When using Xcode 15 to create a project, you may encounter compilation failures due to this option. It is recommended that you disable this option.