SDKsiOS
Publish or update a group announcement
Partially update a group announcement with OpenIM iOS SDK.
Invoke setGroupInfoDictionary:onSuccess:onFailure: to publish or update a group announcement (typically restricted to group owners and administrators):
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupInfoDictionary | NSDictionary * | Yes | Dictionary containing the target groupID and modified key-value pairs. |
Dictionary keys
| Parameter | Type | Required | Description |
|---|---|---|---|
groupID | NSString * | Yes | Target group ID. |
notification | NSString * | Yes | Group 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
- Local state update: The client updates the local cached group's announcement text matching
groupID. - Event notification: All members in the group receive an updated
OIMGroupInfoobject through theonGroupInfoChanged:listener callback. - Re-query calibration: To verify group state immediately, call
getSpecifiedGroupsInfo:onSuccess:onFailure:. For listener setup, refer to Groups overview.
Was this page helpful?