Overview (iOS)

Last updated: 2020-03-12 17:05:32


IM SDK Concepts

Conversation: there are two types of conversations in the IM SDK. One is the C2C conversation, which is a one-to-one chat between users with messages read and sent within the conversation. The other is the group conversation, which is a group chat where all group members can receive messages.

Message: a message in the IM SDK is the information to be sent to the recipient. A message includes properties such as whether it was read by yourself, whether it was sent successfully, the sender’s account, and the message generation time. A message consists of several Elems, which can be text, images, emojis, and others. A message can contain multiple Elems.

Group ID: a group ID uniquely identifies a group. It is generated by the backend and returned when a group is created.

Introduction to IM SDK Objects

iOS IM SDK objects include the communication manager, conversation, message, and group management. The following table describes them in detail.

Object Description Features
TIMManager Manager Responsible for basic IM SDK operations such as initialization, login, logout, and creating conversations
TIMConversation Conversation Responsible for conversation-related operations such as sending messages, obtaining cached conversation messages, and obtaining the unread count
TIMMessage Message Support various message types including text and image messages
TIMGroupManager Group manager Responsible for creating groups, adding and deleting members, and modifying group profiles
TIMFriendshipManager Friend relationship chain manager Responsible for adding and deleting friends and managing friend profiles

Calling Sequence

The IM SDK calls APIs in the following sequence, and other methods will be called after login succeeds.

Step Function Description
Initialization TIMManager:initSdk Configure SDK settings
Initialization TIMManager:setUserConfig Configure user settings
Login TIMManager:login Log users in
Receiving and sending messages TIMManager:getConversation Obtain conversations
Receiving and sending messages TIMConversation:sendMessage Send messages
Group management TIMGroupManager Manage groups
Relationship chain management TIMFriendshipManager Manage relationship chains
Logout TIMManager:logout Log users out (optional for users)