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 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 |
+ (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: | (id< V2TIMSDKListener >) | listener |
1.3 Add a Chat listener
- (void) removeIMSDKListener: | (id< V2TIMSDKListener >) | listener |
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: | (id< V2TIMSDKListener >) | listener | |
Initialize the SDK.
- (void) login: | (NSString *) | userID | |
userSig: | (NSString *) | userSig | |
succ: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
2.1 Log in
userID and userSig must be set for login. For the generation of userSig, please see UserSig backend API。
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 *) 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: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
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: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
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: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
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: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
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 *) | groupID | |
groupName: | (NSString *) | groupName | |
succ: | (V2TIMCreateGroupSucc) | succ | |
fail: | (V2TIMFail) | fail | |
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 *) | msg | |
succ: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
4.4 Join a group
4.5 Quit a group
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: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
5.2 Modify one's own user profile
5.3 Subscribe to user profiles (supported only in Chat Premium 7.4 and later versions)
userIDList |
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) getUserStatus: | (NSArray *) | userIDList | |
succ: | (V2TIMUserStatusListSucc) | succ | |
fail: | (V2TIMFail) | fail | |
5.5 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: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
5.6 Set your own user status (supported only in 6.3 and later versions)
5.7 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 *) | userIDList | |
succ: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
5.8 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. |
- (void) callExperimentalAPI: | (NSString *) | api | |
param: | (NSObject *) | param | |
succ: | (V2TIMCallExperimentalAPISucc) | succ | |
fail: | (V2TIMFail) | fail | |
6.1 Experimental API
api | API name |
param | API parameter |