SDKsiOS
Pin or unpin a conversation
Set a conversation’s pinned state with OpenIM iOS SDK.
Update the pinned status of a specified conversation in the chat list using pinConversation:isPinned:onSuccess:onFailure:.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | NSString * | Yes | Target conversation ID to pin or unpin. |
isPinned | BOOL | Yes | Pinned 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
isPinnedflag into local conversation stores usingconversationIDas the entity key, and re-sort the conversation list. - Asynchronous event listening: Multi-device sessions and local listeners observe updates via
onConversationChanged:inOIMConversationListener(see Retrieve the conversation list). - Re-query calibration: To restore authoritative conversation metadata, invoke Retrieve conversations by ID.
Was this page helpful?