即时通信 IM Unity(搜索好友)

这篇说明腾讯云IM的本地用户搜索功能,用户只能搜索已存储的本地用户资料,并可通过FriendshipSearchFriends接口按关键字搜索userID、nickName、remark字段。 搜索范围:支持设置关键字列表,并指定是否搜索用户ID、昵称、备注字段。

相关产品
即时通信 IM 产品页,含版本规格、价格与购买入口。

一、功能描述

用户搜索只能搜索本地存储过的用户,比如拉取过的好友列表,拉取过的用户资料等。

二、搜索本地用户资料

调用接口 FriendshipSearchFriends (点击查看详情) 可以搜索本地用户资料。
你可以设置搜索关键字 friendship_search_param_keyword_list,并指定搜索的范围,即是否搜索用户的 userID、nickName、remark 字段。

示例代码如下:

// 通过关键词搜索好友FriendSearchParam param = new FriendSearchParam{ friendship_search_param_keyword_list = new List<string> { "关键词1" }, friendship_search_param_search_field_list = new List<TIMFriendshipSearchFieldKey> { TIMFriendshipSearchFieldKey.kTIMFriendshipSearchFieldKey_Identifier, TIMFriendshipSearchFieldKey.kTIMFriendshipSearchFieldKey_NikeName, TIMFriendshipSearchFieldKey.kTIMFriendshipSearchFieldKey_Remark }};TIMResult res = TencentIMSDK.MsgSearchLocalMessages(param, (int code, string desc, List<FriendInfoGetResult> result, string user_data)=>{ // 处理异步逻辑});

赞 (0)
上一篇 4天前
下一篇 4天前