Swift Documentation

Extensions on V2TIMManager

Methods

add​Signaling​Listener(listener:​)

public func addSignalingListener(listener: V2TIMSignalingListener)  

1.1 Add the signaling listener

remove​Signaling​Listener(listener:​)

public func removeSignalingListener(listener: V2TIMSignalingListener)  

1.2 Remove the signaling listener

invite(invitee:​data:​online​User​Only:​offline​Push​Info:​timeout:​succ:​fail:​)

public func invite(invitee: String, data: String?, onlineUserOnly: Bool, offlinePushInfo: V2TIMOfflinePushInfo?, timeout: Int, succ: V2TIMSucc?, fail: V2TIMFail?) -> String?  

1.3 Invite someone

Parameters

invitee String

Invitee's user ID

data String?

Custom data

timeout Int

Timeout duration, in seconds. If it is set to 0, the SDK will not perform timeout detection or trigger the onInvitationTimeout callback.

online​User​Only Bool

Whether the message can be received only by online users. If this field is set to true, the message can be received only by online users, and the invitation and the canceling, accepting, rejecting, and timeout of the invitation will not appear among historical messages.

offline​Push​Info V2TIMOffline​Push​Info?

Offline push information, where the desc field is required. The information specified by desc will be displayed by default during push.

Returns

inviteID Invitation ID. If the invitation fails, null is returned.

invite​InGroup(group​ID:​invitee​List:​data:​online​User​Only:​timeout:​succ:​fail:​)

public func inviteInGroup(groupID: String, inviteeList: Array<String>, data: String?, onlineUserOnly: Bool, timeout: Int, succ: V2TIMSucc?, fail: V2TIMFail?) -> String?  

1.4 Invite certain users in the group

Parameters

group​ID String

ID of the inviter's group

invitee​List Array<String>

List of invitees. Invitees specified by inviteeList must be in the group specified by groupID. Otherwise, the invitation fails.

timeout Int

Timeout duration, in seconds. If it is set to 0, the SDK will not perform timeout detection or trigger the onInvitationTimeout callback.

online​User​Only Bool

Whether the message can be received only by online users. If this field is set to true, the message can be received only by online users, and the invitation and the canceling, accepting, rejecting, and timeout of the invitation will not appear among historical messages.

Returns

inviteID Invitation ID. If the invitation fails, null is returned.

cancel(invite​ID:​data:​succ:​fail:​)

public func cancel(inviteID: String, data: String?, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.5 Cancel an invitation (called by the inviter)

Parameters

invite​ID String

Invitation ID

accept(invite​ID:​data:​succ:​fail:​)

public func accept(inviteID: String, data: String?, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.6 The invitee accepts the invitation

reject(invite​ID:​data:​succ:​fail:​)

public func reject(inviteID: String, data: String?, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.7 The invitee rejects the invitation

get​Signalling​Info(msg:​)

public func getSignallingInfo(msg: V2TIMMessage) -> V2TIMSignalingInfo?  

1.8 Get the signaling information

If onlineUserOnly is set to false in the invite operation, a custom message is generated for each signaling operation (including the invite, cancel, accept, reject, and timeout operations). The message will be delivered to users via V2TIMAdvancedMsgListener -> onRecvNewMessage and can be pulled by users via historical message pulling. If you want to customize the display text based on the signaling information, call this API to get the signaling information.

Parameters

msg V2TIMMessage

Message object

Returns

V2TIMSignalingInfo Signaling information. If the value is nil, msg is not a signaling message.

add​Invited​Signaling(signaling​Info:​succ:​fail:​)

public func addInvitedSignaling(signalingInfo: V2TIMSignalingInfo, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.9 Add invitation signaling (can be used for invitation signaling triggered by group offline push messages)

This API is mainly used to sync group invitations sent to offline users after they are online. When the invitee clicks the offline push message notification and starts the App:

  1. If the inviter sends 1v1 signaling while the invitee is offline, the SDK can automatically sync the invitation signaling. If the invitation has not timed out, onReceiveNewInvitation will be triggered.
  2. If the inviter sends group signaling while the invitee is offline, different SDK behaviors are as follows:
  3. versions lower than 6.7: SDK cannot automatically sync the invitation signaling. For the invitees to handle the invitation after they are online, the inviter can send an extra C2C offline push message carrying the V2TIMSignalingInfo object to each invitee and, when the invitees receive the offline push message, call addInvitedSignaling to sync V2TIMSignalingInfo to SDK.
  4. versions equal or higher than 6.7: SDK can automatically sync messages in the last 30 seconds. If there are invitation signaling messages that have not timed out, onReceiveNewInvitation will be triggered. You don't need to call this API to sync the invitation signaling info.

modify​Invitation(invite​ID:​data:​succ:​fail:​)

public func modifyInvitation(inviteID: String, data: String, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.10 Modify the invitation (supported only in 6.7 and later versions)