消息撤回
开启消息撤回功能¶
在 RCIM.h
文件中,通过设置 enableMessageRecall
来开启该功能,默认为关闭状态。
@property(nonatomic, assign) BOOL enableMessageRecall;
消息可撤回的时间¶
在 RCIM.h
文件中,通过 maxRecallDuration
设置消息可撤回的时间值,默认为 120 秒,表示消息发送后 120 秒内可以选择撤回该消息。
@property(nonatomic, assign) NSUInteger maxRecallDuration;
撤回接口¶
调用以下接口,您也可以自己来实现撤回消息的功能
参数 | 类型 | 说明 |
---|---|---|
messageId | long | 被撤回的消息Id |
/*!
撤回消息并更新UI
@discussion 只有存储并发送成功的消息才可以撤回。
*/
- (void)recallMessage:(long)messageId;
消息被撤回回调方法¶
参数 | 类型 | 说明 |
---|---|---|
messageId | long | 被撤回的消息ID |
/*!
消息被撤回的回调方法
@discussion 被撤回的消息会变更为RCRecallNotificationMessage,App需要在UI上刷新这条消息。
*/
- (void)onRCIMMessageRecalled:(long)messageId;
消息被撤回发送的通知¶
/*!
@const 消息被撤回的Notification
@discussion 消息被撤回后,SDK会分发此通知。
Notification的object为NSNumber的messageId。
与RCIMReceiveMessageDelegate的区别:
RCKitDispatchRecallMessageNotification只要注册都可以收到通知;RCIMReceiveMessageDelegate需要设置监听,并同时只能存在一个监听。
*/
FOUNDATION_EXPORT NSString *const RCKitDispatchRecallMessageNotification;