上传短信的代码:
func sendFeedback(with message: FeedbackMessage){
guard let conversation = self.currentConversation else {
return
}
if let image = message.image {
guard let scaledImage = image.scaledToSafeUploadSize,let data = scaledImage.jpegData(compressionQuality: 0.4) else {return}
let imageObj = AVFile(data: data)
let avMessage = AVIMImageMessage(text: nil, attachedFilePath: imageObj.url()!, attributes: nil)
conversation.send(avMessage){ succeed, error in
print("消息发送: \(error?.localizedDescription ?? "发送消息成功")")
}
}else{
let avMessage = AVIMTextMessage(text: message.content, attributes: nil)
conversation.send(avMessage){ succeed, error in
print("消息发送: \(error?.localizedDescription ?? "发送消息成功")")
}
}
}
短信输入完成后显示在用户页面是没问题的,比如,输入“new message”, 屏幕结果:
但是云端里的消息数据却变成这样:
然后在重新载入短信后,就变成这样。。
其他信息:
access:
app_version: 1.0
sdk_version: v11.4.2
os: iOS
os_version: 12.0
------ BEGIN LeanCloud IM Out Command ------
content: <AVIMGenericCommand 0x7b4400065400>: {
cmd: session
op: open
appId: "9MxLhkV3dQoq9S6tSIPlqiPm-gzGzoHsz"
peerId: "5baf4513808ca40072ee2d12"
i: 1
sessionMessage {
ua: "ios/v11.4.2"
deviceToken: "c23e3294-554d-4969-bf09-a1ef23aaf6e1"
configBitmap: 43
}
}
------ END ---------------------------------
------ BEGIN LeanCloud IM In Command ------
content: <AVIMGenericCommand 0x7b4400026700>: {
cmd: session
op: opened
appId: "9MxLhkV3dQoq9S6tSIPlqiPm-gzGzoHsz"
peerId: "5baf4513808ca40072ee2d12"
i: 1
service: 2
sessionMessage {
st: "dQoq9S6tSIPlqiPm-gzGzoHsz808ca40072ee2d12WeCVH+8aRLO5DyqVv93QJw"
stTtl: 17280
}
}
------ END --------------------------------
------ BEGIN LeanCloud IM Out Command ------
content: <AVIMGenericCommand 0x7b4400023b40>: {
cmd: logs
i: 2
logsMessage {
cid: "5bb741da5b90c830ff81758c"
l: 20
t: 64092211200000
tt: 0
}
}
------ END ---------------------------------
------ BEGIN LeanCloud IM In Command ------
content: <AVIMGenericCommand 0x7b44000d7dc0>: {
cmd: logs
peerId: "5baf4513808ca40072ee2d12"
i: 2
service: 2
logsMessage {
logs {
from: "5baf4513808ca40072ee2d12"
data: "{"_lctype":-1,"_lctext":"Message"}"
timestamp: 1538736751873
msgId: "VbEwKoopQz2wa7yNujD8_A"
convType: 1
}
logs {
from: "5baf4513808ca40072ee2d12"
data: "{"_lctype":-1,"_lctext":"发送一个消息"}"
timestamp: 1538737370290
msgId: "Zca02VLjQJuRcUuMdXpVag"
convType: 1
}
logs {
from: "5baf4513808ca40072ee2d12"
data: "{"_lctype":-1,"_lctext":"发送一个消息"}"
timestamp: 1538738255983
msgId: "I0G0gkaTRyevuTnZ4IyOPA"
convType: 1
}
logs {
from: "5baf4513808ca40072ee2d12"
data: "{"_lctype":-1,"_lctext":"New message"}"
timestamp: 1538738445739
msgId: "Uh8MYJoxRP+IKKqfeQK1hQ"
convType: 1
}
}
}
------ END --------------------------------