In-app Chat
  • iOS : Objective-C
  • Android
  • Web
  • Flutter
  • React Native
  • Unity3D
  • Windows
  • macOS
  • Introduction
    • Overview
    • Basic concepts
  • Sample app
  • Getting started
  • Client SDKs
    • SDK downloads
    • Release notes
    • Upgrade guide
  • Guides
    • Authentication
    • Manage users
    • Room
    • Group
    • Messaging
    • Call invitation (signaling)
    • Manage sessions
  • Offline push notifications
  • Error codes
  • Client APIs
  • Server APIs
  • Documentation
  • In-app Chat
  • Guides
  • Manage users

Manage users

Last updated:2022-07-29 11:44

ZEGOCLOUD's In-app Chat (the ZIM SDK) provides the capability of user management, allows users to update their personal profile, such as username, and status updates.

Prerequisites

  • Create a project in ZEGOCLOUD Console. Then, contact Technical Support to activate the In-app Chat service, and get the AppID and ServerSecret for SDK integration. The ZIM service permission is not enabled by default. Before using it, please activate the ZIM service by yourself in ZEGOCLOUD Console (for details, please refer to Project Management - In-app Chat), if you cannot activate the ZIM service, please contact ZEGOCLOUD technical support to activate it.
  • Get the Token that SDK required for login authentication. For details, see Authentication.
  • Integrate the ZIM SDK. For details, see the Integrate the SDK chapter of Send and receive messages.

Change usernames

userName is a string that can be set by configuring the ZIMUserInfo object.

To change the userName after logging in, call the updateUserName method.

You will receive the results through the callback ZIMUserNameUpdatedCallback.

Sample method call

- (void)updateUserName:(NSString *)userName callback:(ZIMUserNameUpdatedCallback)callback;

Parameter description

Parameter Type Required Description
userName NSString Yes New username.
callback ZIMUserNameUpdatedCallback Yes Callback for change a new username.

Sample code

// Change username.
NSString *userName = @"";

[zim updateUserName:userName callback:^(NSString * _Nonnull userName, ZIMError * _Nonnull errorInfo) {

}];

Query user profile

To query and view the user profile (username, extension fields) of a specified user, call the queryUsersInfo method. The user extended field info can be obtained only using this method.

You will receive the query results through the callback ZIMUsersInfoQueriedCallback.

Sample method call

- (void)queryUsersInfo:(NSArray<NSString *> *)userIDs
              callback:(ZIMUsersInfoQueriedCallback)callback;

Parameter description

Parameter Type Required Description
userIDs NSArray<NSString *> Yes List of the user IDs to be queried.
callback ZIMUsersInfoQueriedCallback Yes Callback for query user profile.

Sample code

// Query user profile.
[self.zim queryUsersInfo:@[@"userID_1",@"userID_2"] callback:^(NSArray<ZIMUserFullInfo *> * _Nonnull userList, NSArray<ZIMErrorUserInfo *> * _Nonnull errorUserList, ZIMError * _Nonnull errorInfo) {

}];
Page Directory