Browse SDKs · iOS
Platform
SDKsiOS

Set permission to add friends from a group

Control whether group members can send friend requests through a group with OpenIM iOS SDK.

Copy

Invoke setGroupInfoDictionary:onSuccess:onFailure: to configure whether group members can initiate friend requests to other members directly from the group:

Parameters

ParameterTypeRequiredDescription
groupInfoDictionaryNSDictionary *YesDictionary containing the target groupID and friend addition permissions.

Friend permission options

Enumeration valueNumeric valueDescription
OIMAllowTypeAllowed0Members can send friend requests to fellow group members.
OIMAllowTypeNotAllowed1Members 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

  1. Local state update: The client updates the local cached group's applyMemberFriend property matching groupID.
  2. Event notification: Group members receive an updated OIMGroupInfo object through the onGroupInfoChanged: listener callback.
  3. 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.