Skip to main content

searchFriends

Feature Description

Note

Search for friends in your friends list using keywords.

Caution

(1) You must specify at least one search domain. (2) Multiple domains are related by an OR logic.

Function Prototype


- (void)searchFriends:(OIMSearchFriendsParam *)searchParam
onSuccess:(nullable OIMSearchUsersInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

Input Parameters

Parameter NameParameter TypeMandatoryDescription
OIMSearchFriendsParam.keywordListNSArray<NSString *>Search keyword, currently only supports one keyword and can't be empty
OIMSearchFriendsParam.isSearchUserIDBOOLSearch by UserID?
OIMSearchFriendsParam.isSearchNicknameBOOLSearch by nickname? Default is false
OIMSearchFriendsParam.isSearchRemarkBOOLSearch by remark? Default is false

Return Value

Parameter NameParameter TypeDescription
onSuccessNSArray< OIMSearchFriendsInfo * >Successful return
onFailureOIMFailureCallbackFailed return

OIMSearchFriendsInfo

Field NameField TypeDescription
ownerUserIDNSStringCurrently logged-in User ID
friendUserIDNSStringFriend's ID
nicknameNSStringFriend's nickname
faceURLNSStringProfile picture
remarkNSStringFriend's remark
createTimeNSIntegerTime of becoming friends
addSourceNSIntegerMethod of becoming friends
operatorUserIDNSStringUser ID who initiated the friendship
attachedInfoNSStringNot currently in use
exNSStringExtension field
relationshipOIMRelationship0 for blacklist, 1 for friend

Code Example


OIMSearchFriendsParam *param = [OIMSearchFriendsParam new];
param.keywordList = @[];
param.isSearchRemark = YES;
param.isSearchUserID = YES;

[OIMManager.manager searchFriends:param
onSuccess:^(NSArray<OIMSearchFriendsInfo *> * _Nullable usersInfo) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];