NIMTeamManager Protocol Reference

Conforms to NSObject
Declared in NIMTeamManagerProtocol.h

Overview

群组协议

– allMyTeams required method

获取所有群组

- (nullable NSArray<NIMTeam*> *)allMyTeams

Return Value

返回所有群组

Discussion

获取所有群组

Declared In

NIMTeamManagerProtocol.h

– teamById: required method

根据群组 ID 获取具体的群组信息

- (nullable NIMTeam *)teamById:(NSString *)teamId

Parameters

teamId

群组 ID

Return Value

群组信息

Discussion

根据群组 ID 获取具体的群组信息

如果自己不在群里,则该接口返回 nil

Declared In

NIMTeamManagerProtocol.h

– isMyTeam: required method

根据群组ID判断是否是我所在的群

- (BOOL)isMyTeam:(NSString *)teamId

Parameters

teamId

群组ID

Return Value

是否在此群组

Discussion

根据群组ID判断是否是我所在的群

Declared In

NIMTeamManagerProtocol.h

– createTeam:users:completion: required method

创建群组

- (void)createTeam:(NIMCreateTeamOption *)option users:(NSArray<NSString*> *)users completion:(nullable NIMTeamCreateHandler)completion

Parameters

option

创建群选项

users

用户Accid列表

completion

完成后的回调

Discussion

创建群组

Declared In

NIMTeamManagerProtocol.h

– dismissTeam:completion: required method

解散群组

- (void)dismissTeam:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

teamId

群组ID

completion

完成后的回调

Discussion

解散群组

Declared In

NIMTeamManagerProtocol.h

– quitTeam:completion: required method

退出群组

- (void)quitTeam:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

teamId

群组ID

completion

完成后的回调

Discussion

退出群组

Declared In

NIMTeamManagerProtocol.h

– addUsers:toTeam:postscript:attach:completion: required method

邀请用户入群

- (void)addUsers:(NSArray<NSString*> *)users toTeam:(NSString *)teamId postscript:(nullable NSString *)postscript attach:(nullable NSString *)attach completion:(nullable NIMTeamMemberHandler)completion

Parameters

users

用户ID列表

teamId

群组ID

postscript

邀请附言

attach

扩展消息

completion

完成后的回调

Discussion

邀请用户入群

Declared In

NIMTeamManagerProtocol.h

– kickUsers:fromTeam:completion: required method

从群组内移除成员

- (void)kickUsers:(NSArray<NSString*> *)users fromTeam:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

users

需要移除的用户ID列表

teamId

群组ID

completion

完成后的回调

Discussion

从群组内移除成员

Declared In

NIMTeamManagerProtocol.h

– updateTeamName:teamId:completion: required method

更新群组名称

- (void)updateTeamName:(NSString *)teamName teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

teamName

群组名称

teamId

群组ID

completion

完成后的回调

Discussion

更新群组名称

Declared In

NIMTeamManagerProtocol.h

– updateTeamAvatar:teamId:completion: required method

更新群组头像

- (void)updateTeamAvatar:(NSString *)teamAvatarUrl teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

teamAvatarUrl

群组头像Url

teamId

群组ID

completion

完成后的回调

Discussion

更新群组头像

Declared In

NIMTeamManagerProtocol.h

– updateTeamJoinMode:teamId:completion: required method

更新群组验证方式

- (void)updateTeamJoinMode:(NIMTeamJoinMode)joinMode teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

joinMode

验证方式

teamId

群组ID

completion

完成后的回调

Discussion

更新群组验证方式

Declared In

NIMTeamManagerProtocol.h

– updateTeamInviteMode:teamId:completion: required method

更新群组邀请他人方式

- (void)updateTeamInviteMode:(NIMTeamInviteMode)inviteMode teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

inviteMode

邀请方式

teamId

群组ID

completion

完成后的回调

Discussion

更新群组邀请他人方式

Declared In

NIMTeamManagerProtocol.h

– updateTeamBeInviteMode:teamId:completion: required method

更新群组被邀请人验证方式

- (void)updateTeamBeInviteMode:(NIMTeamBeInviteMode)beInviteMode teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

beInviteMode

邀请方式

teamId

群组ID

completion

完成后的回调

Discussion

更新群组被邀请人验证方式

Declared In

NIMTeamManagerProtocol.h

– updateTeamUpdateInfoMode:teamId:completion: required method

更改群组更新信息的权限

- (void)updateTeamUpdateInfoMode:(NIMTeamUpdateInfoMode)updateInfoMode teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

updateInfoMode

修改谁有权限更新群组信息

teamId

群组ID

completion

完成后的回调

Discussion

更改群组更新信息的权限

Declared In

NIMTeamManagerProtocol.h

– updateTeamUpdateClientCustomMode:teamId:completion: required method

更改群组更新自定义字段的权限

- (void)updateTeamUpdateClientCustomMode:(NIMTeamUpdateClientCustomMode)clientCustomMode teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

clientCustomMode

修改谁有权限更新群组自定义字段

teamId

群组ID

completion

完成后的回调

Discussion

更改群组更新自定义字段的权限

Declared In

NIMTeamManagerProtocol.h

– updateTeamIntro:teamId:completion: required method

更新群介绍

- (void)updateTeamIntro:(NSString *)intro teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

intro

群介绍

teamId

群组ID

completion

完成后的回调

Discussion

更新群介绍

Declared In

NIMTeamManagerProtocol.h

– updateTeamAnnouncement:teamId:completion: required method

更新群公告

- (void)updateTeamAnnouncement:(NSString *)announcement teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

announcement

群公告

teamId

群组ID

completion

完成后的回调

Discussion

更新群公告

Declared In

NIMTeamManagerProtocol.h

– updateTeamCustomInfo:teamId:completion: required method

更新群自定义信息

- (void)updateTeamCustomInfo:(NSString *)info teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

info

群自定义信息

teamId

群组ID

completion

完成后的回调

Discussion

更新群自定义信息

Declared In

NIMTeamManagerProtocol.h

– updateTeamInfos:teamId:completion: required method

更新群信息

- (void)updateTeamInfos:(NSDictionary<NSNumber*,NSString*> *)values teamId:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

values

需要更新的群信息键值对

teamId

群组ID

completion

完成后的回调

Discussion

更新群信息

这个接口可以一次性修改群的多个属性,如名称,公告等,传入的数据键值对是 {@(NIMTeamUpdateTag) : NSString},无效数据将被过滤

Declared In

NIMTeamManagerProtocol.h

– applyToTeam:message:completion: required method

群申请

- (void)applyToTeam:(NSString *)teamId message:(NSString *)message completion:(nullable NIMTeamApplyHandler)completion

Parameters

teamId

群组ID

message

申请消息

completion

完成后的回调

Discussion

群申请

Declared In

NIMTeamManagerProtocol.h

– passApplyToTeam:userId:completion: required method

通过群申请

- (void)passApplyToTeam:(NSString *)teamId userId:(NSString *)userId completion:(nullable NIMTeamApplyHandler)completion

Parameters

teamId

群组ID

userId

申请的用户ID

completion

完成后的回调

Discussion

通过群申请

Declared In

NIMTeamManagerProtocol.h

– rejectApplyToTeam:userId:rejectReason:completion: required method

拒绝群申请

- (void)rejectApplyToTeam:(NSString *)teamId userId:(NSString *)userId rejectReason:(NSString *)rejectReason completion:(nullable NIMTeamHandler)completion

Parameters

teamId

群组ID

userId

申请的用户ID

rejectReason

拒绝理由

completion

完成后的回调

Discussion

拒绝群申请

Declared In

NIMTeamManagerProtocol.h

– updateUserNick:newNick:inTeam:completion: required method

更新成员群昵称

- (void)updateUserNick:(NSString *)userId newNick:(NSString *)newNick inTeam:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

userId

群成员ID

newNick

新的群成员昵称

teamId

群组ID

completion

完成后的回调

Discussion

更新成员群昵称

Declared In

NIMTeamManagerProtocol.h

– updateMyCustomInfo:inTeam:completion: required method

更新成员群自定义属性

- (void)updateMyCustomInfo:(NSString *)newInfo inTeam:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

newInfo

新的自定义属性

teamId

群组ID

completion

完成后的回调

Discussion

更新成员群自定义属性

Declared In

NIMTeamManagerProtocol.h

– addManagersToTeam:users:completion: required method

添加管理员

- (void)addManagersToTeam:(NSString *)teamId users:(NSArray<NSString*> *)users completion:(nullable NIMTeamHandler)completion

Parameters

teamId

群组ID

users

需要添加为管理员的用户ID列表

completion

完成后的回调

Discussion

添加管理员

Declared In

NIMTeamManagerProtocol.h

– removeManagersFromTeam:users:completion: required method

移除管理员

- (void)removeManagersFromTeam:(NSString *)teamId users:(NSArray<NSString*> *)users completion:(nullable NIMTeamHandler)completion

Parameters

teamId

群组ID

users

需要移除管理员的用户ID列表

completion

完成后的回调

Discussion

移除管理员

Declared In

NIMTeamManagerProtocol.h

– transferManagerWithTeam:newOwnerId:isLeave:completion: required method

移交群主

- (void)transferManagerWithTeam:(NSString *)teamId newOwnerId:(NSString *)newOwnerId isLeave:(BOOL)isLeave completion:(nullable NIMTeamHandler)completion

Parameters

teamId

群组ID

newOwnerId

新群主ID

isLeave

是否同时离开群组

completion

完成后的回调

Discussion

移交群主

Declared In

NIMTeamManagerProtocol.h

– acceptInviteWithTeam:invitorId:completion: required method

接受入群邀请

- (void)acceptInviteWithTeam:(NSString *)teamId invitorId:(NSString *)invitorId completion:(nullable NIMTeamHandler)completion

Parameters

teamId

群组ID

invitorId

邀请者ID

completion

完成后的回调

Discussion

接受入群邀请

Declared In

NIMTeamManagerProtocol.h

– rejectInviteWithTeam:invitorId:rejectReason:completion: required method

拒绝入群邀请

- (void)rejectInviteWithTeam:(NSString *)teamId invitorId:(NSString *)invitorId rejectReason:(NSString *)rejectReason completion:(nullable NIMTeamHandler)completion

Parameters

teamId

群组ID

invitorId

邀请者ID

rejectReason

拒绝原因

completion

完成后的回调

Discussion

拒绝入群邀请

Declared In

NIMTeamManagerProtocol.h

– updateNotifyState:inTeam:completion: required method

修改群通知状态

- (void)updateNotifyState:(NIMTeamNotifyState)state inTeam:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

state

群通知状态

teamId

群组ID

completion

完成后的回调

Discussion

修改群通知状态

Declared In

NIMTeamManagerProtocol.h

– notifyStateForNewMsg: required method

群通知状态

- (NIMTeamNotifyState)notifyStateForNewMsg:(NSString *)teamId

Parameters

teamId

群Id

Return Value

群通知状态

Discussion

群通知状态

Declared In

NIMTeamManagerProtocol.h

– updateMuteState:userId:inTeam:completion: required method

群成员禁言

- (void)updateMuteState:(BOOL)mute userId:(NSString *)userId inTeam:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

mute

是否禁言

userId

用户ID

teamId

群组ID

completion

经验操作完成后的回调

Discussion

群成员禁言

操作成功后,云信服务器会下发禁言的群通知消息

Declared In

NIMTeamManagerProtocol.h

– updateMuteState:inTeam:completion: required method

禁言群全体成员

- (void)updateMuteState:(BOOL)mute inTeam:(NSString *)teamId completion:(nullable NIMTeamHandler)completion

Parameters

mute

是否禁言

teamId

群组ID

completion

经验操作完成后的回调

Discussion

禁言群全体成员

操作成功后,云信服务器会下发禁言的群通知消息

Declared In

NIMTeamManagerProtocol.h

– fetchTeamMembers:completion: required method

获取群组成员

- (void)fetchTeamMembers:(NSString *)teamId completion:(nullable NIMTeamMemberHandler)completion

Parameters

teamId

群组ID

completion

完成后的回调

Discussion

获取群组成员

绝大多数情况这个请求都是从本地读取缓存并同步返回,但是由于群成员信息量较大, SDK 采取的是登录后延迟拉取的策略 考虑到用户网络等问题, SDK 有可能没有及时缓存群成员信息,那么这个请求将是个带网络请求的异步操作(增量请求)。 同时这个接口会去请求本地没有缓存的群用户的资料信息,但不会触发 - (void)onUserInfoChanged: 回调。

Declared In

NIMTeamManagerProtocol.h

– fetchTeamMutedMembers:completion: required method

获取群内被禁言的成员列表

- (void)fetchTeamMutedMembers:(NSString *)teamId completion:(nullable NIMTeamMemberHandler)completion

Parameters

teamId

群组ID

completion

完成后的回调

Discussion

获取群内被禁言的成员列表

绝大多数情况这个请求都是从本地读取缓存并同步返回,但是由于群成员信息量较大, SDK 采取的是登录后延迟拉取的策略 考虑到用户网络等问题, SDK 有可能没有及时缓存群成员信息,那么这个请求将是个带网络请求的异步操作(增量请求)。 同时这个接口会去请求本地没有缓存的群用户的资料信息,但不会触发 - (void)onUserInfoChanged: 回调。

Declared In

NIMTeamManagerProtocol.h

– fetchTeamMembersFromServer:completion: required method

通过网络请求获取群组成员 *

- (void)fetchTeamMembersFromServer:(NSString *)teamId completion:(nullable NIMTeamMemberHandler)completion

Parameters

teamId

群组ID

completion

完成后的回调

Discussion

通过网络请求获取群组成员 *

通过网络请求获取群成员列表,不同于fetchTeamMembers:completion这个接口是个必然带网络请求的异步操作(增量请求) 同时这个接口会去请求本地没有缓存的群用户的资料信息,但不会触发 - (void)onUserInfoChanged: 回调。

Declared In

NIMTeamManagerProtocol.h

– fetchInviterAccids:withTargetMembers:completion: required method

获取群成员邀请人Accid

- (void)fetchInviterAccids:(NSString *)teamID withTargetMembers:(NSArray<NSString*> *)memberIDs completion:(nullable NIMTeamFetchInviterAccidsHandler)completion

Parameters

teamID

群组ID

memberIDs

查询的成员ID,数目不允许大于200

completion

完成后的回调

Discussion

获取群成员邀请人Accid

Declared In

NIMTeamManagerProtocol.h

– fetchTeamInfo:completion: required method

获取群信息

- (void)fetchTeamInfo:(NSString *)teamId completion:(nullable NIMTeamFetchInfoHandler)completion

Parameters

teamId

群组ID

completion

完成后的回调

Discussion

获取群信息

Declared In

NIMTeamManagerProtocol.h

– teamMember:inTeam: required method

获取单个群成员信息

- (nullable NIMTeamMember *)teamMember:(NSString *)userId inTeam:(NSString *)teamId

Parameters

userId

用户ID

teamId

群组ID

Return Value

返回成员信息

Discussion

获取单个群成员信息

返回本地缓存的群成员信息,如果本地没有相应数据则返回 nil。

Declared In

NIMTeamManagerProtocol.h

– searchTeamWithOption:completion: required method

查询群信息

- (void)searchTeamWithOption:(NIMTeamSearchOption *)option completion:(NIMTeamSearchHandler)completion

Parameters

option

查询选项

completion

完成回调

Discussion

查询群信息

返回本地缓存的群成员信息,如果本地没有相应数据则返回 nil。

Declared In

NIMTeamManagerProtocol.h

– updateTInfosLocal: required method

更新群本地信息

- (BOOL)updateTInfosLocal:(NSArray<NIMTeam*> *)teams

Parameters

teams

需要更新的群对象

Discussion

更新群本地信息

这个用于修改本地群信息,不会同步到服务端

Declared In

NIMTeamManagerProtocol.h

– fetchTeamsWithTimestamp:completion: required method

获取所有群信息

- (void)fetchTeamsWithTimestamp:(NSTimeInterval)timestamp completion:(nullable NIMTeamFetchTeamsHandler)block

Parameters

timestamp

0表示全量获取群信息

block

完成后的回调

Discussion

获取所有群信息

从服务端全量拉取群信息,并做本地持久化

Declared In

NIMTeamManagerProtocol.h

– fetchTeamInfoList:completion: required method

获取指定群ID的群信息

- (void)fetchTeamInfoList:(NSArray<NSString*> *)teamIds completion:(NIMTeamFetchTeamInfoListHandler)block

Parameters

teamIds

群ID列表,数组元素超过10个会取前10个

block

完成后的回调

Discussion

获取指定群ID的群信息

从服务端全量拉取群信息,不做本地持久化

Declared In

NIMTeamManagerProtocol.h

– addDelegate: required method

添加群组委托

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

Parameters

delegate

群组委托

Discussion

添加群组委托

Declared In

NIMTeamManagerProtocol.h

– removeDelegate: required method

移除群组委托

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

Parameters

delegate

群组委托

Discussion

移除群组委托

Declared In

NIMTeamManagerProtocol.h