跳到主要内容

sendMessageNotOss

功能介绍

说明

发送消息。

注意

需要先调用createXXXMessage创建一条消息,createXXXMessageByURL创建的消息必须通过此接口发送。
相关回调
onConversationChanged onRecvNewMessage
onRecvNewMessages

函数原型


- (void)sendMessageNotOss:(OIMMessageInfo *)message
recvID:(NSString * _Nullable)recvID
groupID:(NSString * _Nullable)groupID
offlinePushInfo:(OIMOfflinePushInfo * _Nullable)offlinePushInfo
onSuccess:(nullable OIMMessageInfoCallback)onSuccess
onProgress:(nullable OIMNumberCallback)onProgress
onFailure:(nullable OIMFailureCallback)onFailure;

输入参数

参数名称参数类型是否必填描述
messageOIMMessageInfo消息体
recvIDNSSting接收消息的 user ID
groupIDNSSting接收消息的 group ID
offlinePushInfoOIMOfflinePushInfo离线消息体

返回结果

名称类型描述
onSuccessOIMMessageInfo成功返回
onProgressNSInteger发送进度
onFailureOIMFailureCallback失败返回

代码示例


OIMMessageInfo *testMessage = [OIMMessageInfo createSoundMessageByURL:@"https://xxx"
duration:1
size:1];

[OIMManager.manager sendMessageNotOss:testMessage
recvID:@""
groupID:@""
offlinePushInfo:nil
onSuccess:^(OIMMessageInfo * _Nullable message) {
} onProgress:^(NSInteger number) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];