Browse SDKs · iOS
Platform
SDKsiOS

Publish or update a group announcement

Partially update a group announcement with OpenIM iOS SDK.

Copy

Invoke setGroupInfoDictionary:onSuccess:onFailure: to publish or update a group announcement (typically restricted to group owners and administrators):

Parameters

ParameterTypeRequiredDescription
groupInfoDictionaryNSDictionary *YesDictionary containing the target groupID and modified key-value pairs.

Dictionary keys

ParameterTypeRequiredDescription
groupIDNSString *YesTarget group ID.
notificationNSString *YesGroup announcement text. Pass an empty string to clear the current announcement. Note that this uses the notification key rather than introduction.

Code example

NSDictionary *changes = @{
    @"groupID": groupID,
    @"notification": announcement
};

[[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 announcement update.

State changes after the call

  1. Local state update: The client updates the local cached group's announcement text matching groupID.
  2. Event notification: All members in the group receive an updated OIMGroupInfo object through the onGroupInfoChanged: listener callback.
  3. Re-query calibration: To verify group state immediately, call getSpecifiedGroupsInfo:onSuccess:onFailure:. For listener setup, refer to Groups overview.