Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取历史消息一直是0条 #8

Closed
xiaowei772028339 opened this issue Nov 19, 2024 · 7 comments
Closed

获取历史消息一直是0条 #8

xiaowei772028339 opened this issue Nov 19, 2024 · 7 comments

Comments

@xiaowei772028339
Copy link

我和demo一样 初始化的时候调用了, setSyncChannelMessageProvider 方法。只改了里面网络请求方法,也拿到了数据,最后callback(model,nil);同步过去

但是调用这个方法时候
[WKSDK.shared.chatManager pullLastMessages:self.channel limit:15 complete:^(NSArray<WKMessage *> * _Nonnull messages, NSError * _Nonnull error) {

messages一直返回空数组,
拿不到数据 是什么原因呢?是我的数据结构不对造成的吗

@tangtaoit
Copy link
Contributor

tangtaoit commented Nov 19, 2024

看下你对接的接口有没有返回数据,和callback(model,nil);的时候model是否有recent数据

pullLastMessages的数据来自你的接口

@xiaowei772028339
Copy link
Author

看下你对接的接口有没有返回数据,和callback(model,nil);的时候model是否有recent数据

pullLastMessages的数据来自你的接口

您好,这是图片

WechatIMG1301 是有数据,结构是一样的,就payload 服务端做了base64处理,传model前,我已经andemo做了转换

控制的会偶尔提示
getOrSyncHistoryMessages最大重试次数结束!

@xiaowei772028339
Copy link
Author

WechatIMG1302

payload 转换成字典是这样的,是格式不对吗?

@tangtaoit
Copy link
Contributor

type=99是命令消息 pullLastMessages肯定获取不到 pullLastMessages是获取聊天消息,非命令消息, 如果你想自定义消息 参考文档:https://githubim.com/sdk/iossdk/advance/custommessage.html

@xiaowei772028339
Copy link
Author

WechatIMG1303 这次只有两条普通的聊天消息,pullLastMessages数据返回的message还是空的

@tangtaoit
Copy link
Contributor

tangtaoit commented Nov 20, 2024

如果例子程序pullLastMessages可以返回,那你只能自己对比下例子程序的代码了,我们没你的代码 也不好分析

核心点就是确认 callback给sdk的model的里消息字段有值

@xiaowei772028339
Copy link
Author

好的 感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants