Browse SDKs · iOS
Platform
SDKsiOS

Create an emoji message

Create an emoji message with OpenIM iOS SDK.

Copy

Invoke createFaceMessageWithIndex:data: on OIMMessageInfo to construct an in-app sticker or custom face emoji message object:

Parameters

ParameterTypeRequiredDescription
indexNSIntegerYesNumeric index of the sticker within the sticker package.
dataNSString *YesSticker protocol identifier, key name, or custom JSON string.

Code example

OIMMessageInfo *message =
    [OIMMessageInfo createFaceMessageWithIndex:1 data:@"smile"];

Return value

Returns an initialized OIMMessageInfo model with its content type set to custom emoji/sticker.

State changes after the call

  1. Local memory instantiation: This method builds an in-memory message object without writing to the database or initiating network requests.
  2. Sticker protocol agreement: The semantics of index and data are defined by the application layer. Ensure that the sending and receiving clients adhere to matching sticker resources and provide fallback rendering for unrecognized emojis.
  3. Subsequent dispatch: Call Send a message to deliver the sticker message.