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 IM listener
- (void) removeIMSDKListener: | (id< V2TIMSDKListener >) | listener |
1.4 Remove IM 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 Login
userID and userSig must be set for login. For the generation of userSig, please see UserSig backend API。
2.2 Logout
If the user logs out and switches the account, the user can log in again after the logout function calls back success or failure. Otherwise, login may fail.
- (NSString *) getLoginUser |
2.3 Get the login 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 on which you can freely organize your message format (often used to send signaling). However, 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. Though there is no way for all messages to 100% reach every user, 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. Though there is no way for all messages to 100% reach every user, 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 several common group types are preset in the SDK. You can also customize desired group types in the console:
|
groupID | Custom group ID. "null" can be passed in. When "null" is passed in, the system automatically assigns a group ID and calls back the group ID via callback. Custom group ID of "Community" must be prefixed with "@TGS#_". |
groupName | Group name. The value cannot be "null" and can contain up to 30 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
- (void) getUserStatus: | (NSArray *) | userIDList | |
succ: | (V2TIMUserStatusListSucc) | succ | |
fail: | (V2TIMFail) | fail | |
5.3 Get user status information(supported only in 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.4 Setup user status for yourself (supported only in 6.3 and later versions)
5.5 Subscribe user status (supported only in 6.3 and later versions)
userIDList | Identifiers for users whose status will be subscribed. |
- (void) unsubscribeUserStatus: | (NSArray *) | userIDList | |
succ: | (V2TIMSucc) | succ | |
fail: | (V2TIMFail) | fail | |
5.6 Unsubscribe user status (supported only in 6.3 and later versions)
userIDList | Identifiers for users whose status will be unsubscribed. If useridList is empty, status of all users will be unsubscribed. |
- (void) callExperimentalAPI: | (NSString *) | api | |
param: | (NSObject *) | param | |
succ: | (V2TIMCallExperimentalAPISucc) | succ | |
fail: | (V2TIMFail) | fail | |
6.1 Experimental API
api | API name |
param | API parameter |