SDKsiOS
Set the group extension field
Set an application-defined group extension string with OpenIM iOS SDK.
Invoke setGroupInfoDictionary:onSuccess:onFailure: to update custom application-defined extension data for a group (typically restricted to group owners and administrators):
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupInfoDictionary | NSDictionary * | Yes | Dictionary containing the target groupID and extension key-value pairs. |
Dictionary keys
| Parameter | Type | Required | Description |
|---|---|---|---|
groupID | NSString * | Yes | Target group ID. |
ex | NSString * | Yes | Custom extension string (such as serialized JSON). The write completely overwrites the existing value; preserve other module namespaces before saving. |
Code example
NSDictionary *changes = @{
@"groupID": groupID,
@"ex": mergedExtensionJSON
};
[[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 extension update.
State changes after the call
- Local state update: The client updates the local cached group's
exattribute matchinggroupID. - Event notification: Group members receive an updated
OIMGroupInfoobject through theonGroupInfoChanged:listener callback. - Re-query calibration: To calibrate local cache values, call
getSpecifiedGroupsInfo:onSuccess:onFailure:. For listener setup, refer to Groups overview.
Was this page helpful?