NIMUserManager Protocol Reference

Conforms to NSObject
Declared in NIMUserManagerProtocol.h

Overview

Friend manager

– requestFriend:completion: required method

Add a friend

- (void)requestFriend:(NIMUserRequest *)request completion:(nullable NIMUserBlock)completion

Parameters

request

friend request

completion

Completion callback

Discussion

Add a friend

Declared In

NIMUserManagerProtocol.h

– deleteFriend:completion: required method

Delete a friend

- (void)deleteFriend:(NSString *)userId completion:(nullable NIMUserBlock)completion

Parameters

userId

Friend ID

completion

Completion callback

Discussion

Delete a friend

remarks are not deleted

Declared In

NIMUserManagerProtocol.h

– deleteFriend:removeAlias:completion: required method

Delete a friend

- (void)deleteFriend:(NSString *)userId removeAlias:(BOOL)remove completion:(nullable NIMUserBlock)completion

Parameters

userId

Friend ID

remove

specify whether remarks are deleted

completion

Completion callback

Discussion

Delete a friend

Declared In

NIMUserManagerProtocol.h

– myFriends required method

Return a friend list

- (nullable NSArray<NIMUser*> *)myFriends

Return Value

NIMUser list

Discussion

Return a friend list

Declared In

NIMUserManagerProtocol.h

– isMyFriend: required method

Check if the user is included in the friend list

- (BOOL)isMyFriend:(NSString *)userId

Parameters

userId

User ID

Return Value

relationship

Discussion

Check if the user is included in the friend list

Declared In

NIMUserManagerProtocol.h

– addToBlackList:completion: required method

Add a user to the blacklist

- (void)addToBlackList:(NSString *)userId completion:(NIMUserBlock)completion

Parameters

userId

User ID

completion

Completion callback

Discussion

Add a user to the blacklist

Declared In

NIMUserManagerProtocol.h

– removeFromBlackBlackList:completion: required method

Remove a user from the blacklist

- (void)removeFromBlackBlackList:(NSString *)userId completion:(NIMUserBlock)completion

Parameters

userId

User ID

completion

Completion callback

Discussion

Remove a user from the blacklist

Declared In

NIMUserManagerProtocol.h

– isUserInBlackList: required method

Check if a user is included in the blacklist

- (BOOL)isUserInBlackList:(NSString *)userId

Parameters

userId

User ID

Return Value

result

Discussion

Check if a user is included in the blacklist

Declared In

NIMUserManagerProtocol.h

– myBlackList required method

Return all users included in the blacklist

- (nullable NSArray<NIMUser*> *)myBlackList

Return Value

List of NIMUser included in the blacklist

Discussion

Return all users included in the blacklist

Declared In

NIMUserManagerProtocol.h

– updateNotifyState:forUser:completion: required method

Set the notification alert

- (void)updateNotifyState:(BOOL)notify forUser:(NSString *)userId completion:(nullable NIMUserBlock)completion

Parameters

notify

enable or disable the alert

userId

User ID

completion

Completion callback

Discussion

Set the notification alert

Declared In

NIMUserManagerProtocol.h

– notifyForNewMsg: required method

Enable or disable the new message notification

- (BOOL)notifyForNewMsg:(NSString *)userId

Parameters

userId

User ID

Return Value

result

Discussion

Enable or disable the new message notification

Declared In

NIMUserManagerProtocol.h

– myMuteUserList required method

List of muted members

- (nullable NSArray<NIMUser*> *)myMuteUserList

Return Value

List of NIMUser with notifications muted

Discussion

List of muted members

Declared In

NIMUserManagerProtocol.h

– fetchUserInfos:completion: required method

Get multiple user profiles from CommsEase server

- (void)fetchUserInfos:(NSArray<NSString*> *)users completion:(nullable NIMUserInfoBlock)completion

Parameters

users

list of user IDs

completion

completion callback

Discussion

Get multiple user profiles from CommsEase server

The interface is valid if user profiles are hosted on the CommsEase server Calling this interface will not trigger - (void)onUserInfoChanged: callback. This interface will cache the obtained user profiles locally. This interface cannot be called too frequently, which will cause too much useless data to be stored locally and use up the cache space: For example, requesting the user data of each chat room in the chat room will cause oversized caching and affect the application performance This interface allows you to retrieve a maximum of 150 user profiles at a time

Declared In

NIMUserManagerProtocol.h

– userInfo: required method

Get a user profile from the local database

- (nullable NIMUser *)userInfo:(NSString *)userId

Parameters

userId

User IDs

Return Value

NIMUser

Discussion

Get a user profile from the local database

The interface is valid if user profiles are hosted on the CommsEase server and cached on the local storage. User profiles is not guaranteed to be updated in real time except for the current user. The profiles of other users can be updated when: 1. Call - (void)fetchUserInfos:completion: to update users 2. messages are received from the user 3. The app is restarted and partial friends profiles are synced

Declared In

NIMUserManagerProtocol.h

– updateUser:completion: required method

Update the relationship between the current user and the target user

- (void)updateUser:(NIMUser *)user completion:(nullable NIMUserBlock)completion

Parameters

user

target user

completion

Completion callback

Discussion

Update the relationship between the current user and the target user

This interface provides modification of the remark and some extensions. These values are based on the current user and target user relationship, The attribute fields of the same target user will change with different users.

Declared In

NIMUserManagerProtocol.h

– updateMyUserInfo:completion: required method

Edit the profile of the current user

- (void)updateMyUserInfo:(NSDictionary<NSNumber*,id> *)values completion:(nullable NIMUserBlock)completion

Parameters

values

key-value pair to be updated

completion

Completion callback

Discussion

Edit the profile of the current user

This interface can modify multiple attributes at a time, such as nickname and avatar. The passed key-value pair is {@(NIMUserInfoUpdateTag) : NSString/NSNumber}. Invalid data will be filtered. Some fields have restrictions. For more information, see NIMUserInfoUpdateTag.

Declared In

NIMUserManagerProtocol.h

– searchUserWithOption:completion: required method

Search members

- (void)searchUserWithOption:(NIMUserSearchOption *)option completion:(nullable NIMUserInfoBlock)completion

Parameters

option

Search condition

completion

Completion callback

Discussion

Search members

Declared In

NIMUserManagerProtocol.h

– addDelegate: required method

Add the delegate to add a friend

- (void)addDelegate:(id<NIMUserManagerDelegate>)delegate

Parameters

delegate

Delegate to add a friend

Discussion

Add the delegate to add a friend

Declared In

NIMUserManagerProtocol.h

– removeDelegate: required method

Remove the delegate to add a friend

- (void)removeDelegate:(id<NIMUserManagerDelegate>)delegate

Parameters

delegate

friend delegate

Discussion

Remove the delegate to add a friend

Declared In

NIMUserManagerProtocol.h