SDKsiOS
Set permission to add friends from a group
Control whether group members can send friend requests through a group with OpenIM iOS SDK.
Invoke setGroupInfoDictionary:onSuccess:onFailure: to configure whether group members can initiate friend requests to other members directly from the group:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupInfoDictionary | NSDictionary * | Yes | Dictionary containing the target groupID and friend addition permissions. |
Friend permission options
| Enumeration value | Numeric value | Description |
|---|---|---|
OIMAllowTypeAllowed | 0 | Members can send friend requests to fellow group members. |
OIMAllowTypeNotAllowed | 1 | Members are prohibited from initiating friend requests within this group. |
Code example
NSDictionary *changes = @{
@"groupID": groupID,
@"applyMemberFriend": @(OIMAllowTypeNotAllowed)
};
[[OIMManager manager] setGroupInfoDictionary:changes
onSuccess:^(NSString * _Nullable data) {
NSLog(@"setGroupInfoDictionary success");
}
onFailure:^(NSInteger code, NSString *message) {
NSLog(@"setGroupInfoDictionary failed: %ld %@", (long)code, message);
}];Return value
The onSuccess callback returns confirmation when the server accepts the friend permission configuration.
State changes after the call
- Local state update: The client updates the local cached group's
applyMemberFriendproperty matchinggroupID. - Event notification: Group members receive an updated
OIMGroupInfoobject through theonGroupInfoChanged:listener callback. - Re-query calibration: This setting only restricts friend application initiation. To prevent members from viewing other profiles entirely, refer to Set access to member profiles. For listener setup, refer to Groups overview.
Was this page helpful?