SDKsiOS
Create an @ message
Create a text message that mentions specified group members with OpenIM iOS SDK.
Invoke createTextAtMessage:atUsersID:atUsersInfo:message: on OIMMessageInfo to construct a text message mentioning one or more specific group members:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | NSString * | Yes | The text content including @ mention display strings. |
atUsersID | NSArray<NSString *> * | Yes | List of user IDs corresponding to mentioned group members. |
atUsersInfo | NSArray<OIMAtInfo *> * | Yes | List of display models providing member nicknames for UI rendering. |
message | OIMMessageInfo * _Nullable | No | Quoted reference message; pass nil if no message is being quoted. |
Code example
OIMAtInfo *info = [OIMAtInfo new];
info.atUserID = member.userID;
info.groupNickname = member.nickname;
OIMMessageInfo *message =
[OIMMessageInfo createTextAtMessage:text
atUsersID:@[member.userID]
atUsersInfo:@[info]
message:nil];Return value
Returns an initialized OIMMessageInfo model with its content type set to @ mention text.
State changes after the call
- Local memory instantiation: This method creates an in-memory object without writing to the database or triggering network requests.
- Subsequent dispatch: Deliver this message to a group conversation by calling Send a message.
Was this page helpful?