SDKsiOS
Create a Markdown message
Create a Markdown message through OpenIMCore on iOS.
Use the underlying OpenIMCore C function Open_im_sdkCreateMarkdownMessage to construct a message data structure formatted with Markdown syntax:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
payloadJSON | NSString * | Yes | JSON 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
- Local memory instantiation: This function builds an in-memory message structure without persisting to local storage or making network calls.
- Parsing and sanitization: Creation, deserialization, and network transmission are separate stages. Rendering components should sanitize untrusted Markdown and provide text fallbacks if rendering fails.
- Subsequent dispatch: Call Send a message to deliver the Markdown message.
Was this page helpful?