Class Methods | |
| (V2TIMManager *) | + sharedInstance |
|
protected |
Callback definition on success.
|
protected |
Callback definition on fail.
|
protected |
Callback definition on create group successfully.
|
protected |
Callback definition on get user profiles successfully.
|
protected |
Callback definition on search users successfully.
|
protected |
Callback definition for experimental api.
|
protected |
Callback definition on get user status list successfully.
|
protected |
Log callback.
|
protected |
|
protected |
Enumeration definition of log level.
|
protected |
Enumeration definition of message priority.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| + (V2TIMManager*) sharedInstance |
1.1 Get the V2TIMManager instance
| - (BOOL) initSDK: | (int) | sdkAppID | |
| config: | (V2TIMSDKConfig *) | config | |
1.2 Initialize the SDK
| sdkAppID | App ID. This field is required. You can obtain the app ID from the console. |
| config | Configuration information |
| - (void) addIMSDKListener: | (addIMSDKListener(listener:)) | NS_SWIFT_NAME |
1.3 Add a Chat listener
| - (void) removeIMSDKListener: | (removeIMSDKListener(listener:)) | NS_SWIFT_NAME |
1.4 Remove a Chat listener
| - (void) unInitSDK |
1.5 Uninitialize the SDK
| - (NSString*) getVersion |
1.6 Get the SDK version
| - (uint64_t) getServerTime |
1.7 Get the server time
| - (BOOL) initSDK: | (int) | sdkAppID | |
| config: | (V2TIMSDKConfig *) | config | |
| listener: | (_Nullable id< V2TIMSDKListener >) | listener | |
Initialize the SDK.
| - (void) login: | (NSString *) | userID | |
| userSig: | (NSString *) | userSig | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (login(userID:userSig:succ:fail:)) | NS_SWIFT_NAME | |
2.1 Log in
userID and userSig must be set for login. For the generation of userSig, please see UserSig backend API。
| - (void) logout: | (_Nullable V2TIMSucc) | succ | |
| fail: | (logout(succ:fail:)) | NS_SWIFT_NAME | |
2.2 Log out
In the case of switching accounts, after the user logs out, they can log in again only after a logout callback is received (whether the logout succeeds or fails).
| - (NSString * _Nullable) getLoginUser |
2.3 Get the logged in user
| - (V2TIMLoginStatus) getLoginStatus |
2.4 Get the login status
If the user is already in the "logged in" or "logging in" state, do not frequently call the login API to log in.
| - (void) addSimpleMsgListener: | (addSimpleMsgListener(listener:)) | NS_SWIFT_NAME |
3.1 Set the event listener for simple messages (text messages and custom messages)
| - (void) removeSimpleMsgListener: | (removeSimpleMsgListener(listener:)) | NS_SWIFT_NAME |
3.2 Remove the event listener for simple messages (text messages and custom messages)
| - (NSString*) sendC2CTextMessage: | (NSString *) | text | |
| to: | (NSString *) | userID | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (sendC2CTextMessage(text:to:succ:fail:)) | NS_SWIFT_NAME | |
3.3 Send a one-to-one text message (up to 12 KB)
Text messages support sensitive word filtering on the cloud. For example, if a text message sent by a user contains sensitive words, the callback will return the 80001 error code.
| - (NSString*) sendC2CCustomMessage: | (NSData *) | customData | |
| to: | (NSString *) | userID | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (sendC2CCustomMessage(customData:to:succ:fail:)) | NS_SWIFT_NAME | |
3.4 Send a one-to-one custom (signaling) message (up to 12 KB)
A custom message is essentially a binary buffer which allows you to customize your message format (often used to send signaling). Custom messages do not support sensitive word filtering on the cloud.
| - (NSString*) sendGroupTextMessage: | (NSString *) | text | |
| to: | (NSString *) | groupID | |
| priority: | (V2TIMMessagePriority) | priority | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (sendGroupTextMessage(text:to:priority:succ:fail:)) | NS_SWIFT_NAME | |
3.5 Send a group text message (up to 12 KB)
| priority | Message priority. There is no guarantee that each message will reach all users, but higher-priority messages will have a higher delivery success rate.
|
| - (NSString*) sendGroupCustomMessage: | (NSData *) | customData | |
| to: | (NSString *) | groupID | |
| priority: | (V2TIMMessagePriority) | priority | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (sendGroupCustomMessage(customData:to:priority:succ:fail:)) | NS_SWIFT_NAME | |
3.6 Send a group custom (signaling) message (up to 12 KB)
| priority | Message priority. There is no guarantee that each message will reach all users, but higher-priority messages will have a higher delivery success rate.
|
| - (void) addGroupListener: | (addGroupListener(listener:)) | NS_SWIFT_NAME |
4.1 Add the group listener
| - (void) removeGroupListener: | (removeGroupListener(listener:)) | NS_SWIFT_NAME |
4.2 Remove the group listener
| - (void) createGroup: | (NSString *) | groupType | |
| groupID: | (NSString *_Nullable) | groupID | |
| groupName: | (NSString *) | groupName | |
| succ: | (V2TIMCreateGroupSucc) | succ | |
| fail: | (createGroup(groupType:groupID:groupName:succ:fail:)) | NS_SWIFT_NAME | |
4.3 Create a group
| groupType | Group type. The following group types are preset in the SDK. You can also customize group types in the console:
|
| groupID | Custom group ID. "nil" can be passed in. When "nil" is passed in, the system automatically assigns a group ID and returns it via a callback. Custom group ID of "Community" must be prefixed with "@TGS#_". |
| groupName | Group name. The value cannot be "nil". The maximum length is 100 bytes, using UTF-8 encoding, and 1 Chinese character occupies 3 bytes. |
| - (void) joinGroup: | (NSString *) | groupID | |
| msg: | (NSString *_Nullable) | msg | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (joinGroup(groupID:msg:succ:fail:)) | NS_SWIFT_NAME | |
4.4 Join a group
| - (void) quitGroup: | (NSString *) | groupID | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (quitGroup(groupID:succ:fail:)) | NS_SWIFT_NAME | |
4.5 Quit a group
| - (void) dismissGroup: | (NSString *) | groupID | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (dismissGroup(groupID:succ:fail:)) | NS_SWIFT_NAME | |
4.6 Delete a group
| - (void) setGroupListener: | (id< V2TIMGroupListener >) | listener |
Set the group listener
| - (void) getUsersInfo: | (NSArray< NSString * > *) | userIDList | |
| succ: | (V2TIMUserFullInfoListSucc) | succ | |
| fail: | (V2TIMFail) | fail | |
5.1 Get user profiles
| - (void) setSelfInfo: | (V2TIMUserFullInfo *) | Info | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (setSelfInfo(info:succ:fail:)) | NS_SWIFT_NAME | |
5.2 Modify one's own user profile
| - (void) subscribeUserInfo: | (NSArray *) | userIDList | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (subscribeUserInfo(userIDList:succ:fail:)) | NS_SWIFT_NAME | |
5.3 Subscribe to user profiles (supported only in Chat Premium 7.4 and later versions)
| userIDList |
| - (void) unsubscribeUserInfo: | (NSArray *_Nullable) | userIDList | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (unsubscribeUserInfo(userIDList:succ:fail:)) | NS_SWIFT_NAME | |
5.4 Unsubscribe user profile (supported only in Chat Premium 7.4 and later versions)
| userIDList | Identifiers for users whose profiles you want to unsubscribe from. If userIDList is empty, all subscriptions will be canceled. |
| - (void) searchUsers: | (V2TIMUserSearchParam *) | searchParam | |
| succ: | (V2TIMUserSearchResultSucc) | succ | |
| fail: | (searchUsers(searchParam:succ:fail:)) | NS_SWIFT_NAME | |
5.5 Search cloud users (supported only in 8.4 and later versions)
| param | User search parameter. For details, see the definition of V2TIMUserSearchParam. |
| - (void) getUserStatus: | (NSArray *) | userIDList | |
| succ: | (V2TIMUserStatusListSucc) | succ | |
| fail: | (getUserStatus(userIDList:succ:fail:)) | NS_SWIFT_NAME | |
5.6 Get user status information (supported only in Chat Premium 6.3 and later versions)
| userIDList | List of identifier of the users whose information is to be obtained. |
| - (void) setSelfStatus: | (V2TIMUserStatus *) | status | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (setSelfStatus(status:succ:fail:)) | NS_SWIFT_NAME | |
5.7 Set your own user status (supported only in 6.3 and later versions)
| - (void) subscribeUserStatus: | (NSArray *) | userIDList | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (subscribeUserStatus(userIDList:succ:fail:)) | NS_SWIFT_NAME | |
5.8 Subscribe to user status (supported only in Chat Premium 6.3 and later versions)
| userIDList | Identifiers for users whose status you want to subscribe to. |
| - (void) unsubscribeUserStatus: | (NSArray *_Nullable) | userIDList | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (unsubscribeUserStatus(userIDList:succ:fail:)) | NS_SWIFT_NAME | |
5.9 Unsubscribe from user status (supported only in Chat Premium 6.3 and later versions)
| userIDList | Identifiers for users whose status you want to unsubscribe from. If useridList is empty, all subscriptions will be canceled. |
| - (NSObject*) callExperimentalAPI: | (NSString *) | api | |
| param: | (NSObject *_Nullable) | param | |
| succ: | (V2TIMCallExperimentalAPISucc) | succ | |
| fail: | (callExperimentalAPI(api:param:succ:fail:)) | NS_SWIFT_NAME | |
6.1 Experimental API
| api | API name |
| param | API parameter |