SDK APIs (iOS and Mac)

Last updated: 2021-04-23 16:40:38


    Do not use APIs of new and old versions at the same time.

    Initialization and Login APIs

    To use Tencent Cloud IM services, you need to perform initialization and log in.

    API Description
    initSDK Initializes the SDK.
    unInitSDK Uninitializes the SDK.
    login Logs in.
    logout Logs out.
    getLoginStatus Gets the login status.
    getLoginUser Gets the UserID of the current login user.

    Simple Message APIs

    Use the following message APIs if you only need to use text and signaling (a piece of custom buffer) messages.

    API Description
    addSimpleMsgListener Sets an event listener for simple messages (text messages and custom messages).
    Do not use it and addAdvancedMsgListener at the same time.
    removeSimpleMsgListener Removes the event listener for simple messages (text messages and custom messages).
    sendC2CTextMessage Sends a one-to-one (C2C) text message.
    sendC2CCustomMessage Sends a one-to-one (C2C) custom (signaling) message.
    sendGroupTextMessage Sends a group text message.
    sendGroupCustomMessage Sends a group custom (signaling) message.

    Signaling APIs

    API Description
    addSignalingListener Adds a signaling listener.
    removeSignalingListener Removes a signaling listener.
    invite Invites a user.
    inviteInGroup Invites certain users in the group.
    cancel The inviter cancels the invitation.
    accept The invitee accepts the invitation.
    reject The invitee rejects the invitation.
    getSignalingInfo Gets the signaling information.
    addInvitedSignaling Adds invitation signaling (can be used for invitation signaling triggered by group offline push messages).

    Advanced Message APIs

    If you need to send/receive rich media messages (images, videos, files, etc.) and use advanced features such as recalling messages, marking messages as read, and querying message history, use the following set of advanced message APIs. Do not use simple messages APIs and advanced message APIs at the same time.

    API Description
    addAdvancedMsgListener Sets an event listener for advanced messages.
    Do not use it and addSimpleMsgListener at the same time.
    removeAdvancedMsgListener Removes the listener for advanced messages.
    createTextMessage Creates a text message.
    createCustomMessage Creates a custom message.
    createImageMessage Creates an image message.
    createSoundMessage Creates a voice message.
    createVideoMessage Creates a video message.
    createFileMessage Creates a file message.
    createLocationMessage Creates a location message.
    createFaceMessage Creates an emoji message.
    createMergerMessage Creates a combined forward message.
    createForwardMessage Creates a single forward message.
    sendMessage Sends a message. The message object can be created by the createXXXMessage API, where XXX is a variable.
    revokeMessage Recalls a message. The message object can be created by the createXXXMessage API, where XXX is a variable.
    getC2CHistoryMessageList Gets the one-to-one (C2C) message history.
    getGroupHistoryMessageList Gets the group message history.
    markC2CMessageAsRead Marks one-to-one (C2C) messages as read.
    markGroupMessageAsRead Marks group messages as read.
    deleteMessageFromLocalStorage Deletes a message from the local storage.
    insertGroupMessageToLocalStorage Adds a message to the group message list.

    Group APIs

    Tencent Cloud IM SDK supports four preset group types, each of which pertains to different scenarios.

    • Work group (Work): similar t