SDKsiOS
Set message reception for a conversation
Configure message reception for a conversation with OpenIM iOS SDK.
Configure the message reception policy for a specific conversation (such as enabling Do Not Disturb or muting notifications) using setConversationRecvMessageOpt:status:onSuccess:onFailure:.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | NSString * | Yes | Target conversation identifier. |
status | OIMReceiveMessageOpt | Yes | Message reception option enum. |
Message reception options (OIMReceiveMessageOpt)
| Enum | Value | Description |
|---|---|---|
OIMReceiveMessageOptReceive | 0 | Receive messages normally and trigger offline push notifications. |
OIMReceiveMessageOptNotReceive | 1 | Block message reception entirely; suppress offline push notifications. |
OIMReceiveMessageOptNotNotify | 2 | Receive messages while suppressing offline push notifications (Do Not Disturb). |
Code example
[[OIMManager manager] setConversationRecvMessageOpt:@"c2c_user1002"
status:OIMReceiveMessageOptNotNotify
onSuccess:^(NSString * _Nullable data) {
NSLog(@"setConversationRecvMessageOpt success");
}
onFailure:^(NSInteger code, NSString *message) {
NSLog(@"setConversationRecvMessageOpt failed: %ld %@", (long)code, message);
}];Return value
The onSuccess callback confirms that OpenIMServer updated the message reception setting.
State changes after the call
- Local state merge: Merge the updated
recvMsgOptproperty into local conversation models usingconversationIDas the entity key. - Asynchronous event listening: Multi-device clients observe changes via
onConversationChanged:inOIMConversationListener(see Retrieve the conversation list). - Re-query calibration: To verify the active conversation configuration, invoke Retrieve conversations by ID.
Was this page helpful?