Browse SDKs · iOS
SDKsiOS

Set global message reception

Configure the signed-in account’s default message-reception and notification behavior with OpenIM iOS SDK.

Copy
[[OIMManager manager] setGlobalRecvMessageOpt:OIMReceiveMessageOptNotNotify
    onSuccess:nil
    onFailure:nil];
Enum valueNumeric valueMeaning
OIMReceiveMessageOptReceive0Receive messages normally and allow offline push notifications.
OIMReceiveMessageOptNotReceive1Do not receive messages or trigger offline push notifications.
OIMReceiveMessageOptNotNotify2Receive messages without triggering offline push notifications.

If your product exposes only a global Do Not Disturb switch, it normally toggles between Receive and NotNotify. Because NotReceive stops message delivery, present it as a separate option. A successful callback means that the setting request has completed. Retrieve the current user's profile again when you need to confirm the final value.