Browse SDKs · iOS
Platform
SDKsiOS

Pin or unpin a conversation

Set a conversation’s pinned state with OpenIM iOS SDK.

Copy

Update the pinned status of a specified conversation in the chat list using pinConversation:isPinned:onSuccess:onFailure:.

Parameters

ParameterTypeRequiredDescription
conversationIDNSString *YesTarget conversation ID to pin or unpin.
isPinnedBOOLYesPinned state flag. Pass YES to pin the conversation, or NO to unpin it.

Code example

[[OIMManager manager] pinConversation:@"c2c_user1002"
                             isPinned:YES
                            onSuccess:^(NSString * _Nullable data) {
                                NSLog(@"pinConversation success");
                            }
                            onFailure:^(NSInteger code, NSString *message) {
                                NSLog(@"pinConversation failed: %ld %@", (long)code, message);
                            }];

Return value

The onSuccess callback signifies that OpenIMServer updated the pinned status.

State changes after the call

  • Local state merge: Merge the updated isPinned flag into local conversation stores using conversationID as the entity key, and re-sort the conversation list.
  • Asynchronous event listening: Multi-device sessions and local listeners observe updates via onConversationChanged: in OIMConversationListener (see Retrieve the conversation list).
  • Re-query calibration: To restore authoritative conversation metadata, invoke Retrieve conversations by ID.