Set a conversation draft
Save or clear a conversation draft with OpenIM iOS SDK.
Use setConversationDraft:draftText:onSuccess:onFailure: to save the current conversation's draft when the user leaves the chat page, switches conversations, or changes the editor content. While the user is typing, keep the editor state locally and debounce saves; submit the latest text once more immediately before leaving the page.
[[OIMManager manager] setConversationDraft:conversationID
draftText:editorValue
onSuccess:nil
onFailure:nil];Pass an empty string to clear the draft:
[[OIMManager manager] setConversationDraft:conversationID
draftText:@""
onSuccess:nil
onFailure:nil];A successful callback means that the draft-save request has completed. It does not mean that onConversationChanged: has arrived or that the current list snapshot has already been updated. After the event arrives, merge draftText and draftTextTime by conversationID. If the final value must be confirmed immediately, query the conversation again with getMultipleConversation:onSuccess:onFailure:. For complete delegate registration and cleanup, see Retrieve the conversation list. Also clear in-memory editor state when signing out or switching accounts.
Was this page helpful?