Android里面AVIMTypedMessage声明为:
public abstract class AVIMTypedMessage extends AVIMMessage {
public AVIMTypedMessage();

public int getMessageType();

@Override
public final String getContent();

@Override
public final void setContent(String content);
}

为什么不声明一个Map getAttrs() / void setAttrs(Map attr); 方法

像AVIMTextMessage、AVIMFileMessage等子类都声明了attrs的方法。为什么不在基类上统一声明,而要单独声明。

对应IOS的SDK
@interface AVIMTypedMessage : AVIMMessage
@property(nonatomic) AVIMMessageMediaType mediaType;//消息类型,可自定义
@property(nonatomic, strong) NSString *text; // 消息文本
@property(nonatomic, strong) NSDictionary *attributes;// 自定义属性
@property(nonatomic, strong, readonly) AVFile *file; // 附件
@property(nonatomic, strong, readonly) AVGeoPoint *location; // 位置
@end

建议统一下。

因为typedMessage是一个基类,用户可以继承这个类来实现自己的自定义消息类型。如果赋予给AVtypedMessage setAttributes方法的话,就意味着,强制要求用户的自定义消息类型全部都要带有attributes属性。