SDKsiOS
Create a custom message
Create a structured application-defined message with OpenIM iOS SDK.
Invoke createCustomMessage:extension:description: on OIMMessageInfo to construct a message carrying structured business payloads (such as order cards, polls, red packets, or custom transfer receipts):
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
data | NSString * | Yes | Serialized custom business JSON payload string. |
extension | NSString * | Yes | Custom protocol identifier or payload type (such as com.example.order). |
description | NSString * | Yes | Fallback summary string displayed in conversation previews or legacy clients. |
Code example
OIMMessageInfo *message =
[OIMMessageInfo createCustomMessage:jsonString
extension:@"com.example.order"
description:@"[Order Card]"];Return value
Returns an initialized OIMMessageInfo instance configured as a custom message.
State changes after the call
- Local memory instantiation: This method creates an in-memory object only. Receiving clients must validate protocol schemas; critical business states (such as payment processing) must be verified by backend servers.
- Subsequent dispatch: Deliver this message to a user or group conversation by calling Send a message.
Was this page helpful?