Browse SDKs · iOS
Platform
SDKsiOS

Create a Markdown message

Create a Markdown message through OpenIMCore on iOS.

Copy

Use the underlying OpenIMCore C function Open_im_sdkCreateMarkdownMessage to construct a message data structure formatted with Markdown syntax:

Parameters

ParameterTypeRequiredDescription
payloadJSONNSString *YesJSON string containing Markdown body text in the format {"content": "**Markdown text**"}.

Code example

NSString *payloadJSON = @"{\"content\":\"**Project Update**\"}";
NSString *messageJSON = Open_im_sdkCreateMarkdownMessage(payloadJSON);
OIMMessageInfo *message = [OIMMessageInfo mj_objectWithKeyValues:messageJSON];

Return value

The core function returns a JSON string representing the created message. Parse this string into an OIMMessageInfo instance whose body content resides in markdownTextElem.content.

State changes after the call

  1. Local memory instantiation: This function builds an in-memory message structure without persisting to local storage or making network calls.
  2. Parsing and sanitization: Creation, deserialization, and network transmission are separate stages. Rendering components should sanitize untrusted Markdown and provide text fallbacks if rendering fails.
  3. Subsequent dispatch: Call Send a message to deliver the Markdown message.