创建 FACE 自定义表情消息
FACE 消息只传递表情标识和尺寸,不上传图片。发送方与接收方需要用相同的 themeName + stickerName 将消息映射到应用内资源。
接口
objc
- (BIMFaceMessage *)createFaceMessageWithName:(NSString * _Nullable)name
themeName:(NSString *)themeName
stickerName:(NSString *)stickerName
width:(int64_t)width
height:(int64_t)height
isGif:(BOOL)isGif;1
2
3
4
5
6
2
3
4
5
6
| 参数 | 说明 |
|---|---|
name | 展示名,可为空 |
themeName | 表情包主题,如 default |
stickerName | 主题内唯一资源名,如 01 |
width / height | 原始像素尺寸,用于预估气泡布局 |
isGif | 是否为 GIF 动图 |
示例
objc
BIMFaceMessage *message = [[BIMManager sharedInstance]
createFaceMessageWithName:@"01"
themeName:@"default"
stickerName:@"01"
width:240
height:240
isGif:NO];1
2
3
4
5
6
7
2
3
4
5
6
7
swift
let message = BIMManager.sharedInstance().createFaceMessage(
withName: "01",
themeName: "default",
stickerName: "01",
width: 240,
height: 240,
isGif: false
)1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
创建后使用统一的 sendMessage 接口发送。FACE 消息没有 mediaId,SDK 不负责表情图片的资源下载;接入方应内置资源或维护自己的表情包下载与缓存逻辑。收到消息后通过 BIMFaceMessage 的同名属性渲染。
