Browse SDKs · iOS
SDKsiOS

Create an @ message

Create a text message that mentions specified group members with OpenIM iOS SDK.

Copy
OIMAtInfo *info = [OIMAtInfo new];
info.atUserID = member.userID;
info.groupNickname = member.nickname;
OIMMessageInfo *message =
    [OIMMessageInfo createTextAtMessage:text
                              atUsersID:@[member.userID]
                            atUsersInfo:@[info]
                                message:nil];

Use stable user IDs in atUsersID; atUsersInfo supplies display information. Pass the complete quoted message through message when applicable. The underlying implementation limits the number of mentions in one message. After creation, the message can only be sent to a group chat.