跳到主要内容
版本:v3

TapTap 好友指南

SDK 配置

可以在 下载页 获得 TapSDK,引入 TapTap 登录模块。

Unity 开发环境要求:Unity 2019.4 或更高版本

支持版本:

"dependencies":{
"com.taptap.tds.login":"https://github.com/TapTap/TapLogin-Unity.git#3.23.0",
"com.taptap.tds.common": "https://github.com/TapTap/TapCommon-Unity.git#3.23.0",
"com.leancloud.storage": "https://github.com/leancloud/csharp-sdk-upm.git#storage-1.0.2"
}

获取好友列表

调用前请确保登录时已申请好友权限,即使用 TapTap 登录接口时 permissions 参数添加 user_friends

TapFriendResult result = await TapFriends.QueryMutualList(cursor, size);
if (result?.FriendList?.Count > 0) {
foreach (TapFriendInfo friendInfo in result.FriendList) {
Debug.Log($"{friendInfo.Name}, {friendInfo.OpenId}, {friendInfo.Avatar}");
}
}
Debug.Log($"下一游标:{result.Cursor}");

上述参数中 cursor 为每页游标,第一页为 null,后续页游标从上一次返回结果中获取;size 为结果数量。

该接口返回结果 Result 包括好友信息集合和下一页游标 cursor,好友信息集合中每条信息包含的字段说明如下表:

字段名描述
nameTap 昵称
avatarTap 头像
openidTap 用户 openid

当游标 cursor 为 null 时,表示为最后一页数据。