Browse SDKs · iOS
Platform
SDKsiOS

Create a text message

Create a text message with OpenIM iOS SDK.

Copy

Invoke createTextMessage: on OIMMessageInfo to construct an in-memory plain text message object ready for delivery:

Parameters

ParameterTypeRequiredDescription
textNSString *YesPlain text body content. Handle whitespace validation and maximum character length limits before calling.

Code example

OIMMessageInfo *message = [OIMMessageInfo createTextMessage:text];

Return value

Returns an initialized OIMMessageInfo model with its content type set to plain text.

State changes after the call

  1. Local memory instantiation: This synchronous factory method instantiates an object in memory only. It does not save records to local storage, establish network connections, or trigger listener events.
  2. Subsequent dispatch: Send the message to a user or group conversation by calling Send a message.